DrBotIRC: have regex handler take list of events
this is for convenience since doing pubmsg+privmsg will be pretty common
This commit is contained in:
parent
2553e6bed1
commit
319fb5b7e9
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user