def __init__(self): Plugin.__init__(self, 'factoids') self._set_summary(_('Factoids stores strings to a keyword')) self._add_command('factoids', '[<filter>]', _('shows a list of \ keywords')) self._add_command( 'associate', '<word> <info>', _('Associates the \ given info string with the word.')) self._add_command( 'forget', '<word> <id>', _('If id is given it makes \ me delete the word\'s fact with that id, otherwise I forget everything about \ word.')) self._add_command('random_fact', None, _('displays a random fact from \ any word')) self._add_command( 'search_factoid', '<term>', _('searches all \ factoids for term. Add "word:something" in the begining to find only factoids \ of something')) self._add_help_topic( 'association', _('Examples: Arthur is the king \ of the Britons; Romans are hook-nosed.')) self._add_help_topic( 'remembering', _('Example: arthur? - response: \ [0] Arthur is the king of the britons\\n[1] Arthur is seeking the holy grail.') ) self.vault = self._load_resource('vault') self.old_request = None # Contains the last requested sequence if xdata(configuration, self.name, 'signal'): self.factoid_char = xdata(configuration, self.name, 'signal')[0] else: # The signal char will be assigned during the first _listen_ # execution. We can't do this now as here we don't know which it. self.factoid_char = None
def on_connect(self, bot): """ Register the projects/channels for a new connection. """ projects = xdata(bot, self.name, 'report').split() for project, channel_part in [p.split(':', 2) for p in projects]: channels = channel_part.split(',') if not project in self.projects: self.projects[project] = [{}, ()] self.projects[project][0][bot] = channels # If they aren't running yet, start the periodic checks if not self.loop: self.loop = task.LoopingCall(self.mainloop) self.loop.start(60.0) # run every 60 seconds
def on_connect(self, bot): password = xdata(bot, self.name, 'password') if password: log('i', 'Trying to identify with NickServ...') bot.msg('NickServ', 'IDENTIFY ' + password)