Skip to content

Commit d59d144

Browse files
committed
Channel: Fix error in @part when channel is configured but not joined
This typically happens when banned from the channel, and returning an error gives bot admins the impression @part did not remove the channel from the auto-join list
1 parent 03a3777 commit d59d144

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

plugins/Channel/plugin.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -991,9 +991,14 @@ def part(self, irc, msg, args, channel, reason):
991991
network = conf.supybot.networks.get(irc.network)
992992
network.channels().remove(channel)
993993
except KeyError:
994-
pass
995-
if channel not in irc.state.channels:
996-
irc.error(_('I\'m not in %s.') % channel, Raise=True)
994+
if channel not in irc.state.channels:
995+
# Not configured AND not in the channel
996+
irc.error(_('I\'m not in %s.') % channel, Raise=True)
997+
else:
998+
if channel not in irc.state.channels:
999+
# Configured, but not in the channel
1000+
irc.reply(_('%s removed from configured join list.') % channel)
1001+
return
9971002
reason = (reason or self.registryValue("partMsg", channel, irc.network))
9981003
reason = ircutils.standardSubstitute(irc, msg, reason)
9991004
irc.queueMsg(ircmsgs.part(channel, reason))

0 commit comments

Comments
 (0)