Check mark reactions in welcome channel approve user.

A check mark reaction emoji can be used to approve a user, if it is done in the Join/Leave message channel.
It requires the one reacting to have the "Manage Roles" permission.
This commit is contained in:
Vegard Berg 2022-08-04 04:15:28 +02:00
parent 5cf3cdbb08
commit 847d5c8c89
1 changed files with 24 additions and 0 deletions

View File

@ -207,6 +207,30 @@ class Gatekeep(Extension):
str(gk.gatekeep_approve_message).format(member=user, guild=ctx.guild)
)
@listen(events.MessageReactionAdd)
async def on_reaction_add(self, reaction: events.MessageReactionAdd):
if not reaction.emoji.name in [
"",
"",
"",
] or not reaction.author.has_permission(Permissions.MANAGE_ROLES):
return
gk: GatekeepModel
gk, _ = GatekeepModel.get_or_create(guild_id=reaction.guild.id)
jl: JoinLeaveModel
jl, _ = JoinLeaveModel.get_or_create(guild_id=reaction.guild.id)
if reaction.message.channel.id != jl.message_channel:
return
await reaction.message.author.add_role(int(gk.gatekeep_approve_role))
await reaction.message.channel.send(
str(gk.gatekeep_approve_message).format(
member=reaction.message.author, guild=reaction.guild
)
)
@slash_command(
name="captcha",
description="Complete a captcha",