diff --git a/README.md b/README.md index f3cc0f0..e693327 100755 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Based on https://gitlab.com/ao/dpybotbase - [x] Moderation: silentban - [x] Moderation: kick - [x] Moderation: userinfo -- [ ] Moderation: approve-revoke (community) +- [x] Moderation: approve-revoke (community) - [ ] Moderation: addhacker-removehacker - [ ] Moderation: lock-soft-unlock (channel lockdown) - [ ] Moderation: timelock (channel lockdown with time) diff --git a/cogs/mod.py b/cogs/mod.py index 11f7e03..03143fc 100644 --- a/cogs/mod.py +++ b/cogs/mod.py @@ -138,6 +138,42 @@ class ModCog: f"color = {user.colour}\n" f"top_role = {role}\n") + @commands.guild_only() + @commands.check(check_if_staff) + @commands.command() + async def approve(self, ctx): + approval_list = ctx.message.mentions + community_role = ctx.guild.get_role(config.community_role) + for to_approve in approval_list: + await to_approve.add_roles(community_role, + reason=str(ctx.author)) + + await ctx.send(f"Approved {len(approval_list)} member(s).") + log_channel = self.bot.get_channel(config.log_channel) + + approved_mentions = [approved.mention for approved in approval_list] + await log_channel.send(f"✅ Approved: {ctx.author.mention} approved" + f" {len(approval_list)} members\n" + f"{' '.join(approved_mentions)}") # HACK + + @commands.guild_only() + @commands.check(check_if_staff) + @commands.command(aliases=["unapprove"]) + async def revoke(self, ctx): + revoke_list = ctx.message.mentions + community_role = ctx.guild.get_role(config.community_role) + for to_revoke in revoke_list: + await to_revoke.remove_roles(community_role, + reason=str(ctx.author)) + + await ctx.send(f"Un-approved {len(revoke_list)} member(s).") + log_channel = self.bot.get_channel(config.log_channel) + + revoked_mentions = [revoked.mention for revoked in revoke_list] + await log_channel.send(f"❌ Un-approved: {ctx.author.mention} approved" + f" {len(revoke_list)} members\n" + f"{' '.join(revoked_mentions)}") # HACK + @commands.guild_only() @commands.check(check_if_staff) @commands.command(aliases=["setplaying", "setgame"])