示例#1
0
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)
示例#2
0
def setup(bot):
    if "youtube_ids" not in bot.memory:
        bot.memory["youtube_ids"] = SopelIdentifierMemory()
示例#3
0
def setup(bot):
    if 'find_lines' not in bot.memory:
        bot.memory['find_lines'] = SopelIdentifierMemory(
            identifier_factory=bot.make_identifier, )
示例#4
0
def setup(bot):
    if 'find_lines' not in bot.memory:
        bot.memory['find_lines'] = SopelIdentifierMemory()