diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..9bea4330f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +.DS_Store diff --git a/bot.py b/bot.py index 453dbc4d7..5c9d07b2e 100755 --- a/bot.py +++ b/bot.py @@ -108,8 +108,12 @@ def sub(pattern, self=self): func.thread = True if not hasattr(func, 'event'): - func.event = 'PRIVMSG' - else: func.event = func.event.upper() + func.event = ['PRIVMSG'] + else: + if isinstance(func.event, list): + func.event = [element.upper() for element in func.event] + else: + func.event = [func.event.upper()] if hasattr(func, 'rule'): if isinstance(func.rule, str): @@ -205,8 +209,8 @@ def dispatch(self, origin, args): items = self.commands[priority].items() for regexp, funcs in items: for func in funcs: - if event != func.event: continue - + if event not in func.event and '*' not in func.event: continue + if '!'+event in func.event: continue match = regexp.match(text) if match: if self.limit(origin, func): continue