diff options
-rwxr-xr-x | fot.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -94,8 +94,8 @@ class Bot(irc.IRCClient): channel_list = config.get(self.factory.server, 'channels').split() self.module_channels = dict([(x, []) for x in channel_list]) for m in modules.keys(): - if config.has_option('module/' + m, 'filter'): - mod_re = re.compile(config.get('module/' + m, 'filter')) + if config.has_option('module/' + m, 'filter_channel'): + mod_re = re.compile(config.get('module/' + m, 'filter_channel')) else: mod_re = None @@ -127,6 +127,12 @@ class Bot(irc.IRCClient): for mod in self.msg_callbacks: if priv or mod in self.module_channels[channel]: + # This is a somewhat hackish way to get the module name. + mod_name = mod.__module__.split('.')[-1] + if config.has_option('module/' + mod_name, 'filter_nick'): + filter_re = re.compile(config.get('module/' + mod_name, 'filter_nick')) + if not filter_re.match(nick): + continue try: mod.privmsg(nick, channel, msg) except: |