def manage_trivial(self, bot, trigger): """Manage trivial feeds. Usage: .trivial <command>""" text = trigger.group().split() if (len(text) < 2 or text[1] not in self.actions): bot.reply("Usage: .trivial <command>") bot.reply("Available trivial commands: " + ', '.join(self.actions)) return getattr(self, '_trivial_' + text[1])(bot, trigger)
def _trivial_help(self, bot, trigger): """Get help on any of the trivia game commands. Usage: .trivial help <command>""" command = trigger.group(4) if command in self.actions: self._show_doc(bot, command) else: bot.reply("For help on a command, type: .trivial help <command>") bot.reply("Available trivial commands: " + ', '.join(self.actions))
def _show_doc(self, bot, command): """Given an trivial command, say the docstring for the corresponding method.""" for line in getattr(self, '_trivial_' + command).__doc__.split('\n'): line = line.strip() if line: bot.reply(line)