diff options
| -rw-r--r-- | bot/exts/help_channels/_cog.py | 17 | 
1 files changed, 7 insertions, 10 deletions
| diff --git a/bot/exts/help_channels/_cog.py b/bot/exts/help_channels/_cog.py index 262b18e16..6cd31df38 100644 --- a/bot/exts/help_channels/_cog.py +++ b/bot/exts/help_channels/_cog.py @@ -12,7 +12,7 @@ from discord.ext import commands  from bot import constants  from bot.bot import Bot -from bot.exts.help_channels import _caches, _channel, _cooldown, _message, _name, _stats +from bot.exts.help_channels import _caches, _channel, _message, _name, _stats  from bot.utils import channel as channel_utils, lock, scheduling  log = logging.getLogger(__name__) @@ -106,9 +106,11 @@ class HelpChannels(commands.Cog):          """          log.info(f"Channel #{message.channel} was claimed by `{message.author.id}`.")          await self.move_to_in_use(message.channel) -        await _cooldown.revoke_send_permissions(message.author, self.scheduler) +        cooldown_role = self.bot.get_guild(constants.Guild.id).get_role(constants.Roles.help_cooldown) +        await message.author.add_roles(cooldown_role)          await _message.pin(message) +          try:              await _message.dm_on_open(message)          except Exception as e: @@ -276,7 +278,6 @@ class HelpChannels(commands.Cog):          log.trace("Initialising the cog.")          await self.init_categories() -        await _cooldown.check_cooldowns(self.scheduler)          self.channel_queue = self.create_channel_queue()          self.name_queue = _name.create_name_queue( @@ -407,16 +408,12 @@ class HelpChannels(commands.Cog):          """Actual implementation of `unclaim_channel`. See that for full documentation."""          await _caches.claimants.delete(channel.id) -        # Ignore missing tasks because a channel may still be dormant after the cooldown expires. -        if claimant_id in self.scheduler: -            self.scheduler.cancel(claimant_id) -          claimant = self.bot.get_guild(constants.Guild.id).get_member(claimant_id)          if claimant is None:              log.info(f"{claimant_id} left the guild during their help session; the cooldown role won't be removed") -        elif not any(claimant.id == user_id for _, user_id in await _caches.claimants.items()): -            # Remove the cooldown role if the claimant has no other channels left -            await _cooldown.remove_cooldown_role(claimant) +        else: +            cooldown_role = self.bot.get_guild(constants.Guild.id).get_role(constants.Roles.help_cooldown) +            await claimant.remove_roles(cooldown_role)          await _message.unpin(channel)          await _stats.report_complete_session(channel.id, closed_on) | 
