From 03c638705ffa59c06878dfd4d9c8aa3b83a2b9eb Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 12 Apr 2024 19:14:57 +0200 Subject: [PATCH] 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 --- plugins/Channel/plugin.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/Channel/plugin.py b/plugins/Channel/plugin.py index 26ad62501..1f3f97fed 100644 --- a/plugins/Channel/plugin.py +++ b/plugins/Channel/plugin.py @@ -991,9 +991,14 @@ class Channel(callbacks.Plugin): 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))