diff --git a/commands/gatekeep.py b/commands/gatekeep.py index bb5ce66..296ca73 100644 --- a/commands/gatekeep.py +++ b/commands/gatekeep.py @@ -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",