From 246e01154953b1b578c7a858aa9c0fde7f0f5459 Mon Sep 17 00:00:00 2001 From: Vegard Berg Date: Thu, 4 Aug 2022 13:46:07 +0200 Subject: [PATCH] Fixed "approve" command and context menu name conflict. --- commands/gatekeep.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/commands/gatekeep.py b/commands/gatekeep.py index 296ca73..115742e 100644 --- a/commands/gatekeep.py +++ b/commands/gatekeep.py @@ -161,17 +161,18 @@ class Gatekeep(Extension): await ctx.send(f"{user.mention} has been approved.", ephemeral=True) @context_menu( - name="approve", + name="Approve User", dm_permission=False, default_member_permissions=Permissions.MANAGE_ROLES, context_type=CommandTypes.USER, ) - async def approve_context_menu(self, ctx: InteractionContext, user: Member): + async def approve_context_menu(self, ctx: InteractionContext): + user: Member = ctx.target gk: GatekeepModel gk, _ = GatekeepModel.get_or_create(guild_id=ctx.guild.id) jl: JoinLeaveModel jl, _ = JoinLeaveModel.get_or_create(guild_id=ctx.guild.id) - user.add_role(int(gk.gatekeep_approve_role)) + await user.add_role(int(gk.gatekeep_approve_role)) welcome_channel = not jl.message_channel is None @@ -206,6 +207,7 @@ class Gatekeep(Extension): await channel.send( str(gk.gatekeep_approve_message).format(member=user, guild=ctx.guild) ) + await ctx.send(f"{user.mention} has been approved.", ephemeral=True) @listen(events.MessageReactionAdd) async def on_reaction_add(self, reaction: events.MessageReactionAdd):