Make event handlers optional to define

Check if event handlers have been defined before attempting to call them.
This prevents the bot from crashing in the case that an event handler
hasn't been defined.