def collectlines(bot, trigger): """Create a temporary log of what people say""" # Add a log for the channel and nick, if there isn't already one if trigger.sender not in bot.memory['find_lines']: bot.memory['find_lines'][trigger.sender] = SopelIdentifierMemory() if trigger.nick not in bot.memory['find_lines'][trigger.sender]: bot.memory['find_lines'][trigger.sender][trigger.nick] = deque(maxlen=10) # Update in-memory list of the user's lines in the channel line_list = bot.memory['find_lines'][trigger.sender][trigger.nick] line = trigger.group() if line.startswith("s/"): # Don't remember substitutions return # store messages in reverse order (most recent first) elif line.startswith("\x01ACTION"): # For /me messages line = line[:-1] line_list.appendleft(line) else: line_list.appendleft(line)
def setup(bot): if "youtube_ids" not in bot.memory: bot.memory["youtube_ids"] = SopelIdentifierMemory()
def setup(bot): if 'find_lines' not in bot.memory: bot.memory['find_lines'] = SopelIdentifierMemory( identifier_factory=bot.make_identifier, )
def setup(bot): if 'find_lines' not in bot.memory: bot.memory['find_lines'] = SopelIdentifierMemory()