Example #1
0
    def process_message(self, message, nick):
        """Create request object from recived message and process it"""

        # this object persists as it's processed by the bot subsystem.
        # if this requests generates a response, you will receive it along
        # with the response message in protocol_output(), which means you
        # can set arbitrary attributes and access them later, for example
        # a channel to send to for multi-channel protocols, etc.
        req = Request(message)

        # required for most modules
        req.nick = nick

        # some modules expect this to be set as well as logging facility
        req.channel = 'console'

        # force bot into addressed mode
        # many modules require the bot is addressed before triggering.
        req.addressed = True

        # this sets the above flag to true if the user addresses the bot,
        # as well as strips off the bots nick.
        self.checkAddressing(req)

        # pass to substem for final processing
        Madcow.process_message(self, req)
Example #2
0
File: irc.py Project: gipi/Richie
 def stop(self):
     Madcow.stop(self)
     log.info('[IRC] * Quitting IRC')
     message = self.config.irc.quitMessage
     if message is None:
         message = 'no reason'
     self.server.disconnect(message)
Example #3
0
 def stop(self):
     Madcow.stop(self)
     self.log.info('[IRC] * Quitting IRC')
     message = settings.IRC_QUIT_MESSAGE
     if message is None:
         message = u'no reason'
     self.server.disconnect(message)
Example #4
0
 def stop(self):
     Madcow.stop(self)
     log.info(u'[IRC] * Quitting IRC')
     message = self.config.irc.quitMessage
     if message is None:
         message = u'no reason'
     self.server.disconnect(message)
Example #5
0
 def stop(self):
     Madcow.stop(self)
     self.log.info('[IRC] * Quitting IRC')
     message = settings.IRC_QUIT_MESSAGE
     if message is None:
         message = u'no reason'
     self.server.disconnect(message)
Example #6
0
    def process_message(self, message, nick):
        """Create request object from recived message and process it"""

        # this object persists as it's processed by the bot subsystem.
        # if this requests generates a response, you will receive it along
        # with the response message in protocol_output(), which means you
        # can set arbitrary attributes and access them later, for example
        # a channel to send to for multi-channel protocols, etc.
        req = Request(message)

        # required for most modules
        req.nick = nick

        # some modules expect this to be set as well as logging facility
        req.channel = 'console'

        # force bot into addressed mode
        # many modules require the bot is addressed before triggering.
        req.addressed = True

        # this sets the above flag to true if the user addresses the bot,
        # as well as strips off the bots nick.
        self.checkAddressing(req)

        # pass to substem for final processing
        Madcow.process_message(self, req)
Example #7
0
 def process_message(self, message):
     """Create request object from recived message and process it"""
     req = Request(message=message)
     req.nick = os.environ['USER']
     req.channel = 'ipython'
     req.addressed = True
     self.check_addressing(req)
     Madcow.process_message(self, req)
Example #8
0
 def process_message(self, message):
     """Create request object from recived message and process it"""
     req = Request(message=message)
     req.nick = os.environ['USER']
     req.channel = 'ipython'
     req.addressed = True
     self.check_addressing(req)
     Madcow.process_message(self, req)
Example #9
0
    def __init__(self, base, scheme=None):
        if scheme is None:
            scheme = COLOR_SCHEME
        Madcow.__init__(self, base, scheme=scheme)
        passphrase = settings.SILC_PASSPHRASE
        if not passphrase:
            passphrase = ''
        keys = silc.create_key_pair('silc.pub', 'silc.priv', passphrase=passphrase)
        nick = settings.BOTNAME
        silc.SilcClient.__init__(self, keys, nick, nick, nick)
        self.channels = settings.SILC_CHANNELS

        # throttling
        self.delay = settings.SILC_DELAY / float(1000)
        self.last_response = 0.0
Example #10
0
    def __init__(self, base, scheme=None):
        if scheme is None:
            scheme = COLOR_SCHEME
        Madcow.__init__(self, base, scheme=scheme)
        passphrase = settings.SILC_PASSPHRASE
        if not passphrase:
            passphrase = ''
        keys = silc.create_key_pair('silc.pub',
                                    'silc.priv',
                                    passphrase=passphrase)
        nick = settings.BOTNAME
        silc.SilcClient.__init__(self, keys, nick, nick, nick)
        self.channels = settings.SILC_CHANNELS

        # throttling
        self.delay = settings.SILC_DELAY / float(1000)
        self.last_response = 0.0
Example #11
0
File: irc.py Project: gipi/Richie
    def __init__(self, config=None, dir=None):
        Madcow.__init__(self, config=config, dir=dir)

        self.colorlib = ColorLib('mirc')
        if log.root.level <= log.DEBUG:
            irclib.DEBUG = 1
        else:
            irclib.DEBUG = 0
        self.irc = irclib.IRC()
        self.server = self.irc.server()
        for event in self.events:
            log.info('[IRC] * Registering event: %s' % event)
            self.server.add_global_handler(
                event,
                getattr(self, 'on_' + event),
                0,
            )
        if self.config.irc.channels is not None:
            self.channels = self._delim.split(self.config.irc.channels)
        else:
            self.channels = []
        self.names = {}
        self.last_names_update = unix_time()
Example #12
0
File: irc.py Project: gipi/Richie
    def __init__(self, config=None, dir=None):
        Madcow.__init__(self, config=config, dir=dir)

        self.colorlib = ColorLib('mirc')
        if log.root.level <= log.DEBUG:
            irclib.DEBUG = 1
        else:
            irclib.DEBUG = 0
        self.irc = irclib.IRC()
        self.server = self.irc.server()
        for event in self.events:
            log.info('[IRC] * Registering event: %s' % event)
            self.server.add_global_handler(
                event,
                getattr(self, 'on_' + event),
                0,
            )
        if self.config.irc.channels is not None:
            self.channels = self._delim.split(self.config.irc.channels)
        else:
            self.channels = []
        self.names = {}
        self.last_names_update = unix_time()
Example #13
0
 def stop(self):
     """Protocol-specific shutdown procedure"""
     Madcow.stop(self)
Example #14
0
 def __init__(self, config, dir):
     """Protocol-specific initializations"""
     Madcow.__init__(self, config, dir)
Example #15
0
File: cli.py Project: gipi/Richie
 def __init__(self, config=None, dir=None):
     self.colorlib = ColorLib('ansi')
     Madcow.__init__(self, config=config, dir=dir)
     self.user_nick = os.environ['USER']
     self.shell = Shell(polls=[self.check_response_queue])
     self.usageLines += self._cli_usage
Example #16
0
 def __init__(self, config=None, dir=None):
     self.colorlib = ColorLib('ansi')
     Madcow.__init__(self, config=config, dir=dir)
     self.user_nick = os.environ['USER']
     self.shell = Shell(polls=[self.check_response_queue])
     self.usageLines += self._cli_usage
Example #17
0
 def __init__(self, config, dir):
     """Protocol-specific initializations"""
     Madcow.__init__(self, config, dir)
Example #18
0
 def stop(self):
     """Protocol-specific shutdown procedure"""
     Madcow.stop(self)