def on_privmsg(self, msg): """ Appends messages for the specific channel in the line cache. Schedules a message processing after 1s to handle multiline announcements. Might fail since 1s delay is arbitrarily chosen :param msg: IRCMessage object :return: """ nickname = msg.from_nick channel = msg.arguments[0] if not irc_bot.is_channel(channel): log.debug('Received msg is not a channel msg: %s', msg) return if channel not in self.line_cache: self.line_cache[channel] = {} if nickname not in self.line_cache[channel]: self.line_cache[channel][nickname] = [] self.line_cache[channel][nickname].append(msg.arguments[1]) if len(self.line_cache[channel][nickname]) == 1: # Schedule a parse of the message in 1 second (for multilines) self.schedule.queue_command(1, partial(self.process_message, nickname, channel))
def on_privmsg(self, msg): """ Appends messages for the specific channel in the line cache. Schedules a message processing after 1s to handle multiline announcements. :param msg: IRCMessage object :return: """ nickname = msg.from_nick channel = msg.arguments[0] if not irc_bot.is_channel(channel): log.debug('Received msg is not a channel msg: %s', msg) return # set some defaults self.line_cache.setdefault(channel, {}) self.line_cache[channel].setdefault(nickname, []) self.line_cache[channel][nickname].append(msg.arguments[1]) if not self.processing_message: # Schedule a parse of the message in 1 second (for multilines) self.schedule.queue_command(1, partial(self.process_message, nickname, channel)) self.processing_message = True