Skip to content

Commit 96b3017

Browse files
fix: check category before moving to appeal category
This is to prevent attempting to move the thread to the ban appeal category when a user leaves and rejoins the ban appeal server.
1 parent 2b6c6d2 commit 96b3017

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

ban_appeals/ban_appeals.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,20 +157,24 @@ async def _handle_join(self, member: discord.Member) -> None:
157157
if not thread:
158158
return
159159

160-
category = await self.get_useable_appeal_category()
160+
if thread.channel.category.id in self.appeal_categories:
161+
description = "The recipient has joined the appeals server."
162+
else:
163+
category = await self.get_useable_appeal_category()
164+
description = f"Thread moved to `{category}` category since recipient has joined the appeals server."
165+
await thread.channel.move(
166+
category=category,
167+
end=True,
168+
sync_permissions=True,
169+
reason=f"{member} joined appeals server.",
170+
)
171+
161172
embed = discord.Embed(
162-
description=f"Moving thread to `{category}` category since recipient has joined the appeals server.",
173+
description=description,
163174
color=self.bot.mod_color
164175
)
165176
await thread.channel.send(embed=embed)
166177

167-
await thread.channel.move(
168-
category=category,
169-
end=True,
170-
sync_permissions=True,
171-
reason=f"{member} joined appeals server.",
172-
)
173-
174178
async def _handle_remove(self, member: discord.Member) -> None:
175179
"""
176180
Notify if a member who is appealing leaves the appeals guild.

0 commit comments

Comments
 (0)