Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔨 Fix ban in threads #177

Merged
merged 3 commits into from
Mar 11, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions plugins/ban/ban.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,15 @@ async def fake_ban(
user: the user to ban
show_error: whether to show an error message if the ban fails
"""


try:
channel = ctx.channel.parent
except AttributeError:
channel = ctx.channel
ascpial marked this conversation as resolved.
Show resolved Hide resolved

# send the invitation to allow the user to rejoin the guild
try:
invitation = await ctx.channel.create_invite(
invitation = await channel.create_invite(
reason="Friendly ban",
max_uses=1,
unique=True,
Expand All @@ -282,7 +287,7 @@ async def fake_ban(
except discord.Forbidden:
if show_error:
await ctx.send(await ctx.bot._(ctx, 'ban.gunivers.whoups'))

# store the roles somewhere to give them back to the user
self.roles_backup[user.id] = ctx.guild.get_member(
user.id
Expand Down