diff options
| author | 2020-08-04 19:12:31 +0200 | |
|---|---|---|
| committer | 2020-08-04 19:34:10 +0200 | |
| commit | 56f9e84b3bfa07eab4f4623e861cdefada92cdce (patch) | |
| tree | 1e1b797a5285603e07b80ca9911ae9977d646016 | |
| parent | Verification: implement `_verify_kick` helper (diff) | |
Verification: repurpose & rename `_check_users`
Let's only use this function to check on the guild status. It can be
exposed via a command in the future.
Name adjusted to be more accurate w.r.t. Discord terminology.
| -rw-r--r-- | bot/cogs/verification.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/bot/cogs/verification.py b/bot/cogs/verification.py index 85a0e3ec4..4a9983ac8 100644 --- a/bot/cogs/verification.py +++ b/bot/cogs/verification.py @@ -162,16 +162,15 @@ class Verification(Cog): return n_success - async def check_users(self) -> None: + async def _check_members(self) -> t.Tuple[t.Set[discord.Member], t.Set[discord.Member]]: """ - Periodically check in on the verification status of PyDis members. + Check in on the verification status of PyDis members. - This coroutine performs two actions: - * Find members who have not verified for `UNVERIFIED_AFTER` and give them the @Unverified role - * Find members who have not verified for `KICKED_AFTER` and kick them from the guild + This coroutine finds two sets of users: + * Not verified after `UNVERIFIED_AFTER` days, should be given the @Unverified role + * Not verified after `KICKED_AFTER` days, should be kicked from the guild - Within the body of this coroutine, we only select the members for each action. The work is then - delegated to `_kick_members` and `_give_role`. After each run, a report is sent via modlog. + These sets are always disjoint, i.e. share no common members. """ await self.bot.wait_until_guild_available() # Ensure cache is ready pydis = self.bot.get_guild(constants.Guild.id) @@ -205,9 +204,8 @@ class Verification(Cog): elif since_join > timedelta(days=UNVERIFIED_AFTER) and unverified not in member.roles: for_role.add(member) # User should be given the @Unverified role - log.debug(f"{len(for_role)} users will be given the {unverified} role, {len(for_kick)} users will be kicked") - n_kicks = await self._kick_members(for_kick) - n_roles = await self._give_role(for_role, unverified) + log.debug(f"Found {len(for_role)} users for {unverified} role, {len(for_kick)} users to be kicked") + return for_role, for_kick @property def mod_log(self) -> ModLog: |