""" Import your custom command modules here (alternatively, you -could- put all your command handling scripts in the router() class below, but that could prove messy over time) """ from commands import ping_pong, bot_help class router: """ Each function in this class beginning with 'cmd_' represents a command for logbot. Functions intending to be used as callable bot commands MUST use the following format: 'cmd_[command to be issued from irc](self, target, source, command_arguments)' source = *irc nick* that issued command target = *where* the irc nick issued the command command_arguments = string representing everything *to the right of* the command issued (to be parsed or ignored as you wish) Example: Say you have a knobs.config.bot_command_prefix value of '!G' Someone issuing '!Gping randomgibberish' in #example-irc-channel-where-logbot-is-sitting will trigger main.py to call cmd_ping(), passing ' randomgibberish' to command_arguments. In the example above, cmd_ping() just ignores the ' randomgibberish' and simply passes the target and source data to ping_pong.pong() function. However, you could instead choose to parse the 'randomgibberish' and do things with it. Hint: You have two easy ways to send command responses back to a target irc channel or nick: 1) Use postgres_interfacing.send_to_outbox(target, payload) Directly inserts a record into the 'outbox' table (this is the 'raw' function) 2) Use postgres_interfacing.irc_reply(self, target, source, payload) Target and source will be validated before sending data to the 'outbox' table (recommended in most cases) """ def cmd_ping(self, target, source, command_arguments): my_pingpong = ping_pong.ping_pong() my_pingpong.reply(target, source, command_arguments) def cmd_help(self, target, source, command_arguments): my_bot_help = bot_help.bot_help() my_bot_help.reply(target, source, command_arguments) def passive(self, target, source, message): """ If knobs.config.route_all_notifications is set to 'True', then main.py will route ALL 'non-command' messages through this function. Useful for, e.g. log-quoters and archive bots """ pass