Exemplo n.º 1
0
def collectlines(bot, trigger):
    """Create a temporary log of what people say"""

    # Don't log things in PM
    if not trigger.sender.startswith('#'):
        return

    # 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] = WillieMemory()
    if Nick(trigger.nick) not in bot.memory['find_lines'][trigger.sender]:
        bot.memory['find_lines'][trigger.sender][Nick(trigger.nick)] = list()

    # Create a temporary list of the user's lines in a channel
    templist = bot.memory['find_lines'][trigger.sender][Nick(trigger.nick)]
    line = trigger.group()
    if line.startswith("s/"):  # Don't remember substitutions
        return
    elif line.startswith("\x01ACTION"):  # For /me messages
        line = line[:-1]
        templist.append(line)
    else:
        templist.append(line)

    del templist[:-10]  # Keep the log to 10 lines per person

    bot.memory['find_lines'][trigger.sender][Nick(trigger.nick)] = templist
Exemplo n.º 2
0
def collectpls(bot, trigger):
    """Count times users say pls """

    if trigger.is_privmsg:
        return

    if trigger.group(1):
        if '.plscount' in trigger.group(1):
            return

    # Add a count for the channel and nick, if there isn't already one
    if trigger.sender not in bot.memory['pls_count']:
        bot.memory['pls_count'][trigger.sender] = WillieMemory()
    if Identifier(trigger.nick) not in bot.memory['pls_count'][trigger.sender]:
        bot.memory['pls_count'][trigger.sender][Identifier(trigger.nick)] = 0

    # Count them
    count = bot.memory['pls_count'][trigger.sender][Identifier(trigger.nick)]
    count += 1
    bot.memory['pls_count'][trigger.sender][Identifier(trigger.nick)] = count
Exemplo n.º 3
0
def setup(bot):
    bot.memory['find_lines'] = WillieMemory()
Exemplo n.º 4
0
def setup(bot):
    if not bot.memory.contains('url_callbacks'):
        bot.memory['url_callbacks'] = WillieMemory()
    bot.memory['url_callbacks'][post_regex] = rpost_info
    bot.memory['url_callbacks'][user_regex] = redditor_info
Exemplo n.º 5
0
def setup(bot):
    bot.memory['pls_count'] = WillieMemory()
    bot.memory['pls_count_time'] = time.time()