reference handlers directly rather than w/getattr
mostly just picking a convention
This commit is contained in:
parent
903a8f5c80
commit
53caf2b94b
|
@ -14,14 +14,14 @@ class Echo(Plugin):
|
|||
"""Set up the handlers."""
|
||||
|
||||
self.connection.reactor.add_global_regex_handler(['pubmsg', 'privmsg'], r'^!echo\s+(.*)$',
|
||||
getattr(self, 'handle_echo'), -20)
|
||||
self.handle_echo, -20)
|
||||
|
||||
super(Echo, self).start()
|
||||
|
||||
def stop(self):
|
||||
"""Tear down handlers."""
|
||||
|
||||
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], getattr(self, 'handle_echo'))
|
||||
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], self.handle_echo)
|
||||
|
||||
super(Echo, self).stop()
|
||||
|
||||
|
|
|
@ -15,20 +15,20 @@ class ChannelManagement(Plugin):
|
|||
"""Set up the handlers."""
|
||||
|
||||
self.connection.reactor.add_global_regex_handler(['pubmsg', 'privmsg'], r'^!join\s+([\S]+)',
|
||||
getattr(self, 'handle_join'), -20)
|
||||
self.handle_join, -20)
|
||||
self.connection.reactor.add_global_regex_handler(['pubmsg', 'privmsg'], r'^!part\s+([\S]+)',
|
||||
getattr(self, 'handle_part'), -20)
|
||||
self.handle_part, -20)
|
||||
self.connection.reactor.add_global_regex_handler(['pubmsg', 'privmsg'], r'^!quit\s*(.*)',
|
||||
getattr(self, 'handle_quit'), -20)
|
||||
self.handle_quit, -20)
|
||||
|
||||
super(ChannelManagement, self).start()
|
||||
|
||||
def stop(self):
|
||||
"""Tear down handlers."""
|
||||
|
||||
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], getattr(self, 'handle_join'))
|
||||
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], getattr(self, 'handle_part'))
|
||||
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], getattr(self, 'handle_quit'))
|
||||
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], self.handle_join)
|
||||
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], self.handle_part)
|
||||
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], self.handle_quit)
|
||||
|
||||
super(ChannelManagement, self).stop()
|
||||
|
||||
|
|
|
@ -17,21 +17,22 @@ class Markov(Plugin):
|
|||
def start(self):
|
||||
"""Set up the handlers."""
|
||||
|
||||
self.connection.add_global_handler('pubmsg', getattr(self, 'handle_chatter'), -20)
|
||||
self.connection.add_global_handler('privmsg', getattr(self, 'handle_chatter'), -20)
|
||||
self.connection.add_global_handler('pubmsg', self.handle_chatter, -20)
|
||||
self.connection.add_global_handler('privmsg', self.handle_chatter, -20)
|
||||
|
||||
self.connection.reactor.add_global_regex_handler(['pubmsg', 'privmsg'], r'^!markov\s+reply(\s+min=(\d+))?(\s+max=(\d+))?(\s+(.*)$|$)',
|
||||
getattr(self, 'handle_reply'), -20)
|
||||
self.connection.reactor.add_global_regex_handler(['pubmsg', 'privmsg'],
|
||||
r'^!markov\s+reply(\s+min=(\d+))?(\s+max=(\d+))?(\s+(.*)$|$)',
|
||||
self.handle_reply, -20)
|
||||
|
||||
super(Markov, self).start()
|
||||
|
||||
def stop(self):
|
||||
"""Tear down handlers."""
|
||||
|
||||
self.connection.remove_global_handler('pubmsg', getattr(self, 'handle_chatter'))
|
||||
self.connection.remove_global_handler('privmsg', getattr(self, 'handle_chatter'))
|
||||
self.connection.remove_global_handler('pubmsg', self.handle_chatter)
|
||||
self.connection.remove_global_handler('privmsg', self.handle_chatter)
|
||||
|
||||
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], getattr(self, 'handle_reply'))
|
||||
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], self.handle_reply)
|
||||
|
||||
super(Markov, self).stop()
|
||||
|
||||
|
|
|
@ -16,14 +16,14 @@ class Weather(Plugin):
|
|||
"""Set up the handlers."""
|
||||
|
||||
self.connection.reactor.add_global_regex_handler(['pubmsg', 'privmsg'], r'^!weather\s+(.*)$',
|
||||
getattr(self, 'handle_weather'), -20)
|
||||
self.handle_weather, -20)
|
||||
|
||||
super(Weather, self).start()
|
||||
|
||||
def stop(self):
|
||||
"""Tear down handlers."""
|
||||
|
||||
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], getattr(self, 'handle_weather'))
|
||||
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], self.handle_weather)
|
||||
|
||||
super(Weather, self).stop()
|
||||
|
||||
|
|
Loading…
Reference in New Issue