From 7afe193259b8a0909cce73cf53b1aad8f294373d Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 22 Dec 2017 12:11:21 -0800 Subject: [PATCH] bots: fix KeyError when attempting to join a channel not in the index --- plugins/bots.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/bots.py b/plugins/bots.py index 64612f2..d264921 100644 --- a/plugins/bots.py +++ b/plugins/bots.py @@ -104,10 +104,14 @@ def joinclient(irc, source, args): else: irc.join(u, real_channel) + try: + modes = irc.channels[real_channel].modes + except KeyError: + modes = [] + # Call a join hook manually so other plugins like relay can understand it. irc.call_hooks([u, 'PYLINK_BOTSPLUGIN_JOIN', {'channel': real_channel, 'users': [u], - 'modes': irc.channels[real_channel].modes, - 'parse_as': 'JOIN'}]) + 'modes': modes, 'parse_as': 'JOIN'}]) irc.reply("Done.") utils.add_cmd(joinclient, name='join')