diff --git a/plugins/ban/ban.py b/plugins/ban/ban.py index 41887db5..01cecb3c 100644 --- a/plugins/ban/ban.py +++ b/plugins/ban/ban.py @@ -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 """ - + + if isinstance(ctx.channel, discord.Thread): + channel = ctx.channel.parent + else: + channel = ctx.channel + # 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, @@ -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