diff options
| author | 2020-11-25 16:09:40 -0500 | |
|---|---|---|
| committer | 2020-11-25 16:09:40 -0500 | |
| commit | 089efa35345af32c8f5475bb49bd09b9cd3f06c3 (patch) | |
| tree | 754cda355e4da1ebcc8076061b0d61cb3def43b0 | |
| parent | `!close` removes the cooldown role from the claimant even when invoked by som... (diff) | |
`!close` removes role when they have no help channels left; needs to be fixed so role is removed when the channel times out
| -rw-r--r-- | bot/exts/help_channels.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bot/exts/help_channels.py b/bot/exts/help_channels.py index e50fab7fc..e1d28ece3 100644 --- a/bot/exts/help_channels.py +++ b/bot/exts/help_channels.py @@ -223,7 +223,10 @@ class HelpChannels(commands.Cog): guild = self.bot.get_guild(constants.Guild.id) claimant = guild.get_member(await self.help_channel_claimants.get(ctx.channel.id)) await self.move_to_dormant(ctx.channel, "command") - await self.remove_cooldown_role(claimant) + + # Remove the cooldown role if they have no other channels left + if claimant.id not in {user_id for _, user_id in await self.help_channel_claimants.items()}: + await self.remove_cooldown_role(claimant) # Ignore missing task when cooldown has passed but the channel still isn't dormant. if ctx.author.id in self.scheduler: @@ -413,6 +416,8 @@ class HelpChannels(commands.Cog): for channel in self.get_category_channels(self.in_use_category): await self.move_idle_channel(channel, has_task=False) + log.trace(f'Initial state of help_channel_claimants: {await self.help_channel_claimants.items()}') + # Prevent the command from being used until ready. # The ready event wasn't used because channels could change categories between the time # the command is invoked and the cog is ready (e.g. if move_idle_channel wasn't called yet). |