diff --git a/irc/base_command.py b/irc/base_command.py index 8713020..31750f6 100644 --- a/irc/base_command.py +++ b/irc/base_command.py @@ -7,10 +7,10 @@ class BaseCommand(object): """A base class for commands on IRC.""" self.connection = connection - def get_hook(self): + def get_hooks(self): """Hooks are: 'msg', 'msg_private', 'msg_public', and 'join'. Return - the hook you want this command to be called on.""" - return None + the hooks you want this command to be called on.""" + return [] def get_help(self, command): """Return help information for the command, used by !help. return None diff --git a/irc/command_handler.py b/irc/command_handler.py index d404547..de264bc 100644 --- a/irc/command_handler.py +++ b/irc/command_handler.py @@ -59,7 +59,7 @@ def check(hook, data): data.parse_args() # parse command arguments into data.command and data.args for command in commands: - if command.get_hook() == hook: + if hook in command.get_hooks(): if command.check(data): command.process(data) break diff --git a/irc/commands/chanops.py b/irc/commands/chanops.py index e620fb2..4dc3f11 100644 --- a/irc/commands/chanops.py +++ b/irc/commands/chanops.py @@ -6,8 +6,8 @@ from irc.base_command import BaseCommand from config.irc_config import * class ChanOps(BaseCommand): - def get_hook(self): - return "msg" + def get_hooks(self): + return ["msg"] def get_help(self, command): action = command.capitalize() diff --git a/irc/commands/git.py b/irc/commands/git.py index df439cb..17de4c9 100644 --- a/irc/commands/git.py +++ b/irc/commands/git.py @@ -8,8 +8,8 @@ from config.irc_config import * from irc.base_command import BaseCommand class Git(BaseCommand): - def get_hook(self): - return "msg" + def get_hooks(self): + return ["msg"] def get_help(self, command): return "Commands to interface with the bot's git repository; use '!git help' for sub-command list." diff --git a/irc/commands/help.py b/irc/commands/help.py index a2e2aed..4c9d350 100644 --- a/irc/commands/help.py +++ b/irc/commands/help.py @@ -7,8 +7,8 @@ from irc.data import Data from irc import command_handler class Help(BaseCommand): - def get_hook(self): - return "msg" + def get_hooks(self): + return ["msg"] def get_help(self, command): return "Generates help information." diff --git a/irc/commands/link.py b/irc/commands/link.py index b3cd99a..59f2d6e 100644 --- a/irc/commands/link.py +++ b/irc/commands/link.py @@ -7,8 +7,8 @@ import re from irc.base_command import BaseCommand class Link(BaseCommand): - def get_hook(self): - return "msg" + def get_hooks(self): + return ["msg"] def get_help(self, command): return "Convert a Wikipedia page name into a URL." diff --git a/irc/commands/test.py b/irc/commands/test.py index 64e821d..69ecd2f 100644 --- a/irc/commands/test.py +++ b/irc/commands/test.py @@ -7,8 +7,8 @@ import random from irc.base_command import BaseCommand class Test(BaseCommand): - def get_hook(self): - return "msg" + def get_hooks(self): + return ["msg"] def get_help(self, command): return "Test the bot!"