Skip to content

Commit addfc10

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 addfc10

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

ban_appeals/ban_appeals.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -157,20 +157,23 @@ 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+
description = "The recipient has joined the appeals server."
161+
if thread.channel.category.id not in self.appeal_categories:
162+
category = await self.get_useable_appeal_category()
163+
description = f"Thread moved to `{category}` category since recipient has joined the appeals server."
164+
await thread.channel.move(
165+
category=category,
166+
end=True,
167+
sync_permissions=True,
168+
reason=f"{member} joined appeals server.",
169+
)
170+
161171
embed = discord.Embed(
162-
description=f"Moving thread to `{category}` category since recipient has joined the appeals server.",
172+
description=description,
163173
color=self.bot.mod_color
164174
)
165175
await thread.channel.send(embed=embed)
166176

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

0 commit comments

Comments
 (0)