Implemented some parts of the bot protocol
Refactored bot protocol