From 18a7efcdf38a64ed90389303f6519666de25e5f9 Mon Sep 17 00:00:00 2001 From: PredaaA <46051820+PredaaA@users.noreply.github.com> Date: Tue, 7 Jul 2020 20:45:31 +0200 Subject: [PATCH] [Otherbot] A bit more filtering on event (#135) --- otherbot/otherbot.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/otherbot/otherbot.py b/otherbot/otherbot.py index 816358f..c7421cb 100644 --- a/otherbot/otherbot.py +++ b/otherbot/otherbot.py @@ -11,6 +11,9 @@ class Otherbot(commands.Cog): self.config.register_guild(**default_guild) + def cog_unload(self): + self.otherbot_cache.clear() + async def generate_cache(self): self.otherbot_cache = await self.config.all_guilds() @@ -92,6 +95,8 @@ class Otherbot(commands.Cog): data = self.otherbot_cache.get(after.guild.id) if data is None: return + if not data["watching"]: + return if after.status == discord.Status.offline and (after.id in data["watching"]): channel_object = self.bot.get_channel(data["reporting"]) if not data["ping"]: