コード例 #1
0
ファイル: core.py プロジェクト: Mika64/irc3
 def autojoin(self, **kw):
     """autojoin at the end of MOTD"""
     self.bot.config['nick'] = kw['me']
     self.bot.recompile()
     channels = utils.as_list(self.bot.config.get('autojoins', []))
     for channel in channels:
         channel = utils.as_channel(channel)
         self.bot.log.info('Trying to join %s', channel)
         self.bot.join(channel)
コード例 #2
0
ファイル: core.py プロジェクト: jpcw/irc3
 def autojoin(self, **kw):
     """autojoin at the end of MOTD"""
     self.bot.config['nick'] = kw['me']
     self.bot.recompile()
     channels = utils.as_list(self.bot.config.get('autojoins', []))
     for channel in channels:
         channel = utils.as_channel(channel)
         self.bot.log.info('Trying to join %s', channel)
         self.bot.join(channel)
コード例 #3
0
 def join(self, channel=None):
     if channel is None:
         channels = self.channels
     else:
         channels = [channel]
     for channel in channels:
         channel = utils.as_channel(channel)
         if channel in self.handles:
             timeout, handle = self.handles[channel]
             self.bot.log.info('Re-trying to join %s after %ss', channel,
                               timeout)
         else:
             self.bot.log.info('Trying to join %s', channel)
         self.bot.join(channel)
コード例 #4
0
ファイル: autojoins.py プロジェクト: davols/irc3
 def join(self, channel=None):
     if channel is None:
         channels = self.channels
     else:
         channels = [channel]
     for channel in channels:
         channel = utils.as_channel(channel)
         if channel in self.handles:
             timeout, handle = self.handles[channel]
             self.bot.log.info('Re-trying to join %s after %ss',
                               channel, timeout)
         else:
             self.bot.log.info('Trying to join %s', channel)
         self.bot.join(channel)
コード例 #5
0
ファイル: __init__.py プロジェクト: mickael9/factoirc
    def __init__(self, bot):
        self.bot = bot
        self.reader = None

        self.log = logging.getLogger('irc3.%s' % __name__)
        self.log_parser = LogParser(self.log)

        self.config = dict(DEFAULT_CONFIG)
        self.config.update(bot.config.get(self.__class__.__module__, {}))
        self.log.debug('config: %r', self.config)

        autojoins = self.bot.config.get('autojoins')
        self.channels = [
            as_channel(c)
            for c in as_list(
                self.config.get('channels', autojoins)
            )
        ]

        self.actions = {}

        for act_type in DEFAULT_FORWARDING:
            config = dict(DEFAULT_FORWARDING[act_type])
            config.update(self.bot.config.get(
                '%s.%s-forwarding' % (self.__class__.__module__, act_type)))
            self.actions[act_type] = config

        self.log.debug('actions: %r', self.actions)

        # on_quit needs to be executed before the userlist plugin sees
        # the QUIT event so that we can check which channels the user
        # was in
        self.bot.attach_events(
            irc3.event(irc3.rfc.QUIT, self.on_quit),
            insert=True
        )
        self.log.info('FactoIRC %s loaded.' % __version__)
コード例 #6
0
ファイル: autojoins.py プロジェクト: Satcomx00-x00/DataS-pwn
 def part(self, channel):
     channel = utils.as_channel(channel)
     self.bot.log.info('Leaving channel %s', channel)
     self.bot.part(channel)
     if channel in self.joined:  # pragma: no cover
         self.joined.remove(channel)