diff options
| author | 2020-12-22 20:30:08 -0500 | |
|---|---|---|
| committer | 2020-12-22 20:30:08 -0500 | |
| commit | ce46567546488f87f458b5d4fe1894d90e848044 (patch) | |
| tree | 4662b0e763333c371460679c806cf8fe6cb28b9b | |
| parent | Merge branch 'master' of https://github.com/python-discord/bot into swfarnswo... (diff) | |
Rewrite `!verify` to account for new native-gate-only verification.
Renamed method; if not `user.pending`, adds and immediately removes an arbitrary role (namely the Announcements role), which verifies the user.
| -rw-r--r-- | bot/exts/moderation/verification.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/bot/exts/moderation/verification.py b/bot/exts/moderation/verification.py index ca3e97e2e..dbd3c42a6 100644 --- a/bot/exts/moderation/verification.py +++ b/bot/exts/moderation/verification.py @@ -834,20 +834,21 @@ class Verification(Cog): @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.""" + async def perform_manual_verification(self, ctx: Context, user: discord.Member) -> None: + """Command for moderators to verify 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.mention} is already a developer.') + if user.pending: + log.trace(f'{user.id} is already verified, aborting.') + await ctx.send(f'{constants.Emojis.cross_mark} {user.mention} is already verified.') return - await user.add_roles(developer_role) - await safe_dm(user.send(ALTERNATE_VERIFIED_MESSAGE)) - log.trace(f'Developer role successfully applied to {user.id}') - await ctx.send(f'{constants.Emojis.check_mark} Developer role applied to {user.mention}.') + # Adding a role automatically verifies the user, so we add and remove the Announcements role. + temporary_role = self.bot.get_guild(constants.Guild.id).get_role(constants.Roles.announcements) + await user.add_roles(temporary_role) + await user.remove_roles(temporary_role) + log.trace(f'{user.id} manually verified.') + await ctx.send(f'{constants.Emojis.check_mark} {user.mention} is now verified.') # endregion |