diff --git a/modules/channel_save.py b/modules/channel_save.py index 15b3a6c2..6db99cc1 100644 --- a/modules/channel_save.py +++ b/modules/channel_save.py @@ -30,8 +30,14 @@ class Module(object): channels.append(event["channel"].name) event["server"].set_setting("autojoin", channels) - def on_kick(self, event): - channels = event["server"].get_setting("autojoin", []) - if event["channel"].name in channels: - channels.remove(event["channel"].name) + def _remove_channel(self, server, channel_name): + channels = server.get_setting("autojoin", []) + if channel_name in channels: + channes.remove(channel_name) event["server"].set_setting("autojoin", channels) + + def self_part(self, event): + self._remove_channel(event["server"], event["channel"].name) + + def on_kick(self, event): + self._remove_channel(event["server"], event["channel"].name)