def parse_message(self, message): ''' Takes messages from the socket and converts them into internal events ''' m = self.ircmsg.match(message) if not m: self.log.warn(u'Couldn\'t match message {0}'.format(message)) return None postfix = m.group('postfix') if postfix: postfix = postfix.strip(' ') postfix = postfix.lstrip(':') command = m.group('command') prefix = m.group('prefix') if prefix: prefix = prefix.strip(' ') prefix = prefix.lstrip(':') params = m.group('params') if params: params = params.strip(' ') params = params.split(' ') self.log.debug(u'Cleaned message, prefix = {0}, command = {1}, params = {2}, postfix = {3}'.format(prefix, command, params, postfix)) self.log.info(u'<< {0} {1} {2} {3}'.format(prefix, command, params, postfix)) return eu.irc_msg(command, (command, prefix, params, postfix))
def msg(self, msg, channel, priority=3): ''' Send an irc msg to the given channel args: msg = the message to send channel = The channel to send it to kwargs: priority = how quickly to process the event ''' self.bot.out_event(eu.irc_msg(action, data, priority))