3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-02-23 08:50:44 +01:00

bots: fix KeyError when attempting to join a channel not in the index

This commit is contained in:
James Lu 2017-12-22 12:11:21 -08:00
parent 444d8c53bb
commit 7afe193259

View File

@ -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')