do some ircbot prospector cleanup

bss/dr.botzo#17
This commit is contained in:
2017-03-10 18:51:36 -06:00
parent dbc4e6fe6f
commit 474afe2576
7 changed files with 30 additions and 65 deletions

View File

@@ -0,0 +1 @@
"""Some basic-level IRC plugins."""

View File

@@ -1,18 +1,17 @@
"""Echo given string back to the user/channel."""
import logging
from ircbot.lib import Plugin, reply_destination_for_event
from ircbot.lib import Plugin
log = logging.getLogger('ircbot.lib')
class Echo(Plugin):
"""Have IRC commands to do IRC things (join channels, quit, etc.)."""
def start(self):
"""Set up the handlers."""
self.connection.reactor.add_global_regex_handler(['pubmsg', 'privmsg'], r'^!echo\s+(.*)$',
self.handle_echo, -20)
@@ -20,14 +19,12 @@ class Echo(Plugin):
def stop(self):
"""Tear down handlers."""
self.connection.reactor.remove_global_regex_handler(['pubmsg', 'privmsg'], self.handle_echo)
super(Echo, self).stop()
def handle_echo(self, connection, event, match):
"""Handle the echo command... by echoing."""
return self.bot.reply(event, match.group(1))