Skip to content

Commit

Permalink
[AFK] fix member remove config clear
Browse files Browse the repository at this point in the history
  • Loading branch information
japandotorg committed Oct 23, 2023
1 parent b1219f9 commit 6523507
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions afk/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import TagScriptEngine as tse
from redbot.core import Config, commands
from redbot.core.bot import Red
from redbot.core.utils import AsyncIter
from redbot.core.utils.chat_formatting import humanize_list, pagify
from redbot.core.utils.menus import DEFAULT_CONTROLS, menu

Expand Down Expand Up @@ -209,9 +210,9 @@ async def on_message(self, message: discord.Message):

@commands.Cog.listener()
async def on_member_remove(self, member: discord.Member):
for member_id, data in (await self.config.all_members(guild=member.guild)).items():
if data["afk_status"]:
await self.config.member_from_ids(member.guild.id, member_id).clear()
data = await self.config.all_members(guild=member.guild)
if member.id in data:
await self.config.member_from_ids(member.guild.id, member.id).clear()

@commands.guild_only()
@commands.group(name="afk", invoke_without_command=True)
Expand Down

0 comments on commit 6523507

Please sign in to comment.