Fixed "approve" command and context menu name conflict.

This commit is contained in:
Vegard Berg 2022-08-04 13:46:07 +02:00
parent 2cc865100d
commit 246e011549
1 changed files with 5 additions and 3 deletions

View File

@ -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):