diff options
author | 2020-04-17 09:59:50 -0700 | |
---|---|---|
committer | 2020-04-17 11:45:06 -0700 | |
commit | b209700d7e8d882b2ff3f4ca097c3644d089920c (patch) | |
tree | 2bd780483e25deea2c6540191c74050319036c9d | |
parent | HelpChannels: mention dormant cmd in available message embed (diff) |
HelpChannels: fix role not resetting after dormant command
Resetting permissions relied on getting the member from the cache, but
the member was already removed from the cache prior to resetting the
role. Now the member is passed directly rather than relying on the
cache.
-rw-r--r-- | bot/cogs/help_channels.py | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/bot/cogs/help_channels.py b/bot/cogs/help_channels.py index 149808473..b4fc901cc 100644 --- a/bot/cogs/help_channels.py +++ b/bot/cogs/help_channels.py @@ -230,7 +230,7 @@ class HelpChannels(Scheduler, commands.Cog): del self.help_channel_claimants[ctx.channel] with suppress(discord.errors.HTTPException, discord.errors.NotFound): - await self.reset_claimant_send_permission(ctx.channel) + await self.reset_claimant_send_permission(ctx.author) await self.move_to_dormant(ctx.channel, "command") self.cancel_task(ctx.channel.id) @@ -640,18 +640,8 @@ class HelpChannels(Scheduler, commands.Cog): log.trace(f"Resetting send permissions for {member} ({member.id}).") await member.remove_roles(COOLDOWN_ROLE) - async def reset_claimant_send_permission(self, channel: discord.TextChannel) -> None: - """Reset send permissions in the Available category for the help `channel` claimant.""" - log.trace(f"Attempting to find claimant for #{channel.name} ({channel.id}).") - try: - member = self.help_channel_claimants[channel] - except KeyError: - log.trace( - f"Channel #{channel.name} ({channel.id}) not in claimant cache, " - f"permissions unchanged." - ) - return - + async def reset_claimant_send_permission(self, member: discord.Member) -> None: + """Reset send permissions in the Available category for `member`.""" log.trace(f"Resetting send permissions for {member} ({member.id}).") await member.remove_roles(COOLDOWN_ROLE) |