3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-30 14:49:28 +01:00

games: Only handle self messages if enabled

This commit is contained in:
Daniel Oaks 2016-04-08 09:21:19 +10:00 committed by James Lu
parent c3e4cfa2de
commit cbb2eb318f

View File

@ -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?