Skip to content

Commit

Permalink
Channel: Fix error in @part when channel is configured but not joined
Browse files Browse the repository at this point in the history
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
  • Loading branch information
progval committed Apr 12, 2024
1 parent 03a3777 commit d59d144
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions plugins/Channel/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,9 +991,14 @@ def part(self, irc, msg, args, channel, reason):
network = conf.supybot.networks.get(irc.network)
network.channels().remove(channel)
except KeyError:
pass
if channel not in irc.state.channels:
irc.error(_('I\'m not in %s.') % channel, Raise=True)
if channel not in irc.state.channels:
# Not configured AND not in the channel
irc.error(_('I\'m not in %s.') % channel, Raise=True)
else:
if channel not in irc.state.channels:
# Configured, but not in the channel
irc.reply(_('%s removed from configured join list.') % channel)
return
reason = (reason or self.registryValue("partMsg", channel, irc.network))
reason = ircutils.standardSubstitute(irc, msg, reason)
irc.queueMsg(ircmsgs.part(channel, reason))
Expand Down

0 comments on commit d59d144

Please sign in to comment.