Handling commands before logging chat

Changed the order of logging. Bot commands will now be handled before
the log is updated, so responses should be faster.