diff --git a/bugzilla.py b/bugzilla.py index bf152e9856..5bb96dd050 100644 --- a/bugzilla.py +++ b/bugzilla.py @@ -8,7 +8,7 @@ """ from lxml import etree import re -from willie import web +from willie import web, tools from willie.module import rule import urllib import urllib2 @@ -35,7 +35,7 @@ def setup(bot): and bot.config.bugzilla.get_list('domains')): return if not bot.memory.contains('url_callbacks'): - bot.memory['url_callbacks'] = {} + bot.memory['url_callbacks'] = tools.WillieMemory() domains = '|'.join(bot.config.bugzilla.get_list('domains')) regex = re.compile((r'https?://(%s)' diff --git a/find.py b/find.py index a36a65d5a3..17fbc50d0e 100644 --- a/find.py +++ b/find.py @@ -12,12 +12,12 @@ """ import re -from willie.tools import Nick +from willie.tools import Nick, WillieMemory from willie.module import rule, priority def setup(bot): - bot.memory['find_lines'] = dict() + bot.memory['find_lines'] = WillieMemory() @rule('.*') @@ -31,7 +31,7 @@ def collectlines(bot, trigger): # 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] = dict() + 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() diff --git a/reddit-info.py b/reddit-info.py index 4a5c23a011..e1da91f823 100644 --- a/reddit-info.py +++ b/reddit-info.py @@ -7,6 +7,7 @@ """ from willie.module import commands, rule, example, NOLIMIT +from willie import tools import praw import re domain = r'https?://(?:www\.|np\.)?reddit\.com' @@ -18,7 +19,7 @@ def setup(bot): post_regex = re.compile(post_url) user_regex = re.compile(user_url) if not bot.memory.contains('url_callbacks'): - bot.memory['url_callbacks'] = {} + bot.memory['url_callbacks'] = tools.WillieMemory() bot.memory['url_callbacks'][post_regex] = rpost_info bot.memory['url_callbacks'][user_regex] = redditor_info diff --git a/url.py b/url.py index 032092a7f0..bcd364d1e8 100644 --- a/url.py +++ b/url.py @@ -9,7 +9,7 @@ import re from htmlentitydefs import name2codepoint -import willie.web as web +from willie import web, tools from willie.module import commands, rule import urllib2 import urlparse @@ -64,9 +64,9 @@ def setup(bot): # Ensure that url_callbacks and last_seen_url are in memory if not bot.memory.contains('url_callbacks'): - bot.memory['url_callbacks'] = {} + bot.memory['url_callbacks'] = tools.WillieMemory() if not bot.memory.contains('last_seen_url'): - bot.memory['last_seen_url'] = {} + bot.memory['last_seen_url'] = tools.WillieMemory() if bot.config.has_option('url', 'exclusion_char'): exclusion_char = bot.config.url.exclusion_char diff --git a/youtube.py b/youtube.py index 4dd9a9a71d..d20377307b 100644 --- a/youtube.py +++ b/youtube.py @@ -11,7 +11,7 @@ This module will respond to .yt and .youtube commands and searches the youtubes. """ -from willie import web +from willie import web, tools from willie.module import rule, commands, example import json import re @@ -21,11 +21,8 @@ def setup(bot): regex = re.compile('(youtube.com/watch\S*v=|youtu.be/)([\w-]+)') if not bot.memory.contains('url_callbacks'): - bot.memory['url_callbacks'] = {regex, ytinfo} - else: - exclude = bot.memory['url_callbacks'] - exclude[regex] = ytinfo - bot.memory['url_callbacks'] = exclude + bot.memory['url_callbacks'] = tools.WillieMemory() + bot.memory['url_callbacks'][regex] = exclude def ytget(bot, trigger, uri):