From cbb2eb318f29acbaf8426e643574aed40090cff5 Mon Sep 17 00:00:00 2001 From: Daniel Oaks Date: Fri, 8 Apr 2016 09:21:19 +1000 Subject: [PATCH] games: Only handle self messages if enabled --- plugins/games.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/games.py b/plugins/games.py index 97109ae..2ec6e4d 100644 --- a/plugins/games.py +++ b/plugins/games.py @@ -107,7 +107,7 @@ class CommandHandler: # bot clients class BotClient: - def __init__(self, name, cmd_handler=None): + def __init__(self, name, cmd_handler=None, process_self_messages=False): self.name = name # cmd_handler @@ -116,9 +116,12 @@ class BotClient: self.cmds = cmd_handler # events - utils.add_hook(self.handle_endburst, "ENDBURST") - for cmd in ('PRIVMSG', 'NOTICE', 'PYLINK_SELF_NOTICE', 'PYLINK_SELF_PRIVMSG'): + utils.add_hook(self.handle_endburst, 'ENDBURST') + for cmd in ('PRIVMSG', 'NOTICE'): utils.add_hook(self.handle_messages, cmd) + if process_self_messages: + for cmd in ('PYLINK_SELF_NOTICE', 'PYLINK_SELF_PRIVMSG'): + utils.add_hook(self.handle_messages, cmd) def handle_endburst(self, irc, numeric, command, args): # TODO(dan): name/user/hostname to be configurable, possible status channel?