diff options
| author | 2020-12-10 15:09:47 +0200 | |
|---|---|---|
| committer | 2020-12-10 15:09:47 +0200 | |
| commit | 5559ddbe60cbb97bae4d86bad83d4c221ebf3ec0 (patch) | |
| tree | e5586663beaea8eff9cd4b3ae6c8d2666312369a | |
| parent | Merge pull request #1319 from python-discord/swfarnsworth/superstar (diff) | |
| parent | Merge branch 'master' into swfarnsworth/developer_command (diff) | |
Merge pull request #1322 from python-discord/swfarnsworth/developer_command
New `!verify` command to manually apply the Developer role
| -rw-r--r-- | bot/exts/moderation/verification.py | 18 | 
1 files changed, 17 insertions, 1 deletions
| diff --git a/bot/exts/moderation/verification.py b/bot/exts/moderation/verification.py index c599156d0..c42c6588f 100644 --- a/bot/exts/moderation/verification.py +++ b/bot/exts/moderation/verification.py @@ -756,7 +756,7 @@ class Verification(Cog):          log.trace(f"Bumping verification stats in category: {category}")          self.bot.stats.incr(f"verification.{category}") -    @command(name='accept', aliases=('verify', 'verified', 'accepted'), hidden=True) +    @command(name='accept', aliases=('verified', 'accepted'), hidden=True)      @has_no_roles(constants.Roles.verified)      @in_whitelist(channels=(constants.Channels.verification,))      async def accept_command(self, ctx: Context, *_) -> None:  # We don't actually care about the args @@ -848,6 +848,22 @@ class Verification(Cog):          else:              return True +    @command(name='verify') +    @has_any_role(*constants.MODERATION_ROLES) +    async def apply_developer_role(self, ctx: Context, user: discord.Member) -> None: +        """Command for moderators to apply the Developer role to any user.""" +        log.trace(f'verify command called by {ctx.author} for {user.id}.') +        developer_role = self.bot.get_guild(constants.Guild.id).get_role(constants.Roles.verified) + +        if developer_role in user.roles: +            log.trace(f'{user.id} is already a developer, aborting.') +            await ctx.send(f'{constants.Emojis.cross_mark} {user} is already a developer.') +            return + +        await user.add_roles(developer_role) +        log.trace(f'Developer role successfully applied to {user.id}') +        await ctx.send(f'{constants.Emojis.check_mark} Developer role applied to {user}.') +      # endregion | 
