diff --git a/ircbot/DrBotIRC.py b/ircbot/DrBotIRC.py index 75a0755..1774b5f 100644 --- a/ircbot/DrBotIRC.py +++ b/ircbot/DrBotIRC.py @@ -264,7 +264,7 @@ class DrBotIRC(irclib.IRC): The provided method should take as arguments: * nick the nick creating the event, or None * userhost the userhost creating the event, or None - * event the raw IRC event, which may be None + * event list of the raw IRC events, which may be None * from_admin whether or not the event came from an admin * groups list of match.groups(), from re.search() @@ -276,9 +276,13 @@ class DrBotIRC(irclib.IRC): """ - if not event in self.regex_handlers: - self.regex_handlers[event] = [] - bisect.insort(self.regex_handlers[event], ((priority, regex, handler))) + if type(event) != list: + event = [event] + + for ev in event: + if not ev in self.regex_handlers: + self.regex_handlers[ev] = [] + bisect.insort(self.regex_handlers[ev], ((priority, regex, handler))) def remove_global_regex_handler(self, event, regex, handler): """Removes a global regex handler function.