diff options
| -rw-r--r-- | bot/cogs/help_channels.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/bot/cogs/help_channels.py b/bot/cogs/help_channels.py index 03bac27a4..dbe7cedc1 100644 --- a/bot/cogs/help_channels.py +++ b/bot/cogs/help_channels.py @@ -109,7 +109,7 @@ class HelpChannels(Scheduler, commands.Cog): super().__init__() self.bot = bot - self.help_channel_users: t.Dict[discord.User, discord.TextChannel] = {} + self.help_channel_users: t.Dict[discord.TextChannel, discord.User] = {} # Categories self.available_category: discord.CategoryChannel = None @@ -191,7 +191,7 @@ class HelpChannels(Scheduler, commands.Cog): async def dormant_check(self, ctx: commands.Context) -> bool: """Return True if the user started the help channel session or passes the role check.""" - if self.help_channel_users.get(ctx.author) == ctx.channel: + if self.help_channel_users.get(ctx.channel) == ctx.author: log.trace(f"{ctx.author} started the help session, passing the check for dormant.") return True @@ -563,7 +563,7 @@ class HelpChannels(Scheduler, commands.Cog): await self.move_to_in_use(channel) await self.revoke_send_permissions(message.author) # Add user with channel for dormant check. - self.help_channel_users[message.author] = channel + self.help_channel_users[channel] = message.author log.trace(f"Releasing on_message lock for {message.id}.") @@ -622,11 +622,9 @@ class HelpChannels(Scheduler, commands.Cog): async def reset_send_permissions_for_help_user(self, channel: discord.TextChannel) -> None: """Reset send permissions in the Available category for member that started the help session in `channel`.""" - # Get mapping of channels to users that started the help session in them. - channels_to_users = {value: key for key, value in self.help_channel_users.items()} log.trace(f"Attempting to find user for help session in #{channel.name} ({channel.id}).") try: - member: discord.Member = channels_to_users[channel] + member = self.help_channel_users[channel] except KeyError: log.trace(f"Channel #{channel.name} ({channel.id}) not in help session cache, permissions unchanged.") return |