Fixed "approve" command and context menu name conflict.
This commit is contained in:
parent
2cc865100d
commit
246e011549
|
@ -161,17 +161,18 @@ class Gatekeep(Extension):
|
||||||
await ctx.send(f"{user.mention} has been approved.", ephemeral=True)
|
await ctx.send(f"{user.mention} has been approved.", ephemeral=True)
|
||||||
|
|
||||||
@context_menu(
|
@context_menu(
|
||||||
name="approve",
|
name="Approve User",
|
||||||
dm_permission=False,
|
dm_permission=False,
|
||||||
default_member_permissions=Permissions.MANAGE_ROLES,
|
default_member_permissions=Permissions.MANAGE_ROLES,
|
||||||
context_type=CommandTypes.USER,
|
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
|
||||||
gk, _ = GatekeepModel.get_or_create(guild_id=ctx.guild.id)
|
gk, _ = GatekeepModel.get_or_create(guild_id=ctx.guild.id)
|
||||||
jl: JoinLeaveModel
|
jl: JoinLeaveModel
|
||||||
jl, _ = JoinLeaveModel.get_or_create(guild_id=ctx.guild.id)
|
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
|
welcome_channel = not jl.message_channel is None
|
||||||
|
|
||||||
|
@ -206,6 +207,7 @@ class Gatekeep(Extension):
|
||||||
await channel.send(
|
await channel.send(
|
||||||
str(gk.gatekeep_approve_message).format(member=user, guild=ctx.guild)
|
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)
|
@listen(events.MessageReactionAdd)
|
||||||
async def on_reaction_add(self, reaction: events.MessageReactionAdd):
|
async def on_reaction_add(self, reaction: events.MessageReactionAdd):
|
||||||
|
|
Loading…
Reference in New Issue