def on_message(self, sender, channel, flags, message, private): req = Request(message=message) req.nick = sender.nickname req.private = private req.silc_sender = sender if private: req.addressed = True req.sendto = sender req.channel = u'privmsg' else: req.addressed = False req.sendto = channel req.channel = channel.channel_name req.message = decode(req.message) req.message = self.colorlib.strip_color(req.message) self.check_addressing(req) if req.message.startswith(u'^'): req.message = req.message[1:] req.colorize = True else: req.colorize = False self.process_message(req)
def on_message(self, server, event, private, action=False): """process incoming messages""" req = Request(message=event.arguments()[0]) req.nick = irclib.nm_to_n(event.source()) req.channel = event.target() req.private = private req.action = action if private: req.sendto = req.nick req.addressed = True else: req.sendto = req.channel req.addressed = False req.message = decode(req.message) # strip control codes from incoming lines req.message = self.colorlib.strip_color(req.message) # strip adressing and set req attributes self.check_addressing(req) # lines that start with ^ will have their output rainbowed if req.message.startswith(u'^'): req.message = req.message[1:] req.colorize = True else: req.colorize = False # send to bot subsystem for processing self.process_message(req)
def on_message(self, server, event, private, action=False): """process incoming messages""" req = Request(message=event.arguments()[0]) req.nick = irclib.nm_to_n(event.source()) req.channel = event.target() req.private = private req.action = action if private: req.sendto = req.nick req.addressed = True else: req.sendto = req.channel req.addressed = False req.message = req.message.decode(settings.ENCODING, 'replace') # strip control codes from incoming lines req.message = self.colorlib.strip_color(req.message) # strip adressing and set req attributes self.check_addressing(req) # lines that start with ^ will have their output rainbowed if req.message.startswith(u'^'): req.message = req.message[1:] req.colorize = True else: req.colorize = False # send to bot subsystem for processing self.process_message(req)
def run(self): self.output(u"type 'help' for a list of commands") while self.running: self.check_response_queue() try: input = self.shell.readline(self._prompt) except IOError: # this happens when you get EINTR from SIGHUP handling continue input = input.decode(sys.stdin.encoding, 'replace') if input.lower() == u'quit': break if input.lower() == u'history': print u'history: %s' % repr(self.shell.history) continue if input.lower() == u'clear': sys.stdout.write(self._clear) continue if len(input) > 0: req = Request(message=input) req.nick = self.user_nick req.channel = u'cli' req.private = True req.addressed = True self.check_addressing(req) if req.message.startswith(u'^'): req.colorize = True req.message = req.message[1:] try: self.user_nick = self._new_nick.search(req.message).group(1) self.output(u'nick changed to: %s' % self.user_nick, req) continue except: pass self.process_message(req)
def run(self): self.output("type 'help' for a list of commands") while self.running: self.check_response_queue() try: input = self.shell.readline(self._prompt) except IOError: # this happens when you get EINTR from SIGHUP handling continue if input.lower() == 'quit': break if input.lower() == 'history': print 'history: %s' % repr(self.shell.history) if input.lower() == 'clear': sys.stdout.write(self._clear) continue if len(input) > 0: req = Request(message=input) req.nick = self.user_nick req.channel = 'cli' req.private = True req.addressed = True self.checkAddressing(req) if req.message.startswith('^'): req.colorize = True req.message = req.message[1:] try: self.user_nick = self._new_nick.search( req.message).group(1) self.output('nick changed to: %s' % self.user_nick, req) continue except: pass self.process_message(req)