Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ These changes are available on the `master` branch, but have not yet been releas
- Fixed `Guild.create_test_entitlement()` and `User.create_test_entitlement()` using the
guild/user ID instead of the application ID.
([#2595](https://github.com/Pycord-Development/pycord/pull/2595))
- Fixed commands with `BucketType.cagegory` cooldown causing issues in private channels.
([#2603](https://github.com/Pycord-Development/pycord/pull/2603))

### Changed

Expand Down
8 changes: 7 additions & 1 deletion discord/ext/commands/cooldowns.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from collections import deque
from typing import TYPE_CHECKING, Any, Callable, Deque, TypeVar

import discord.abc
from discord.enums import Enum

from ...abc import PrivateChannel
Expand Down Expand Up @@ -69,7 +70,12 @@ def get_key(self, msg: Message) -> Any:
elif self is BucketType.member:
return (msg.guild and msg.guild.id), msg.author.id
elif self is BucketType.category:
return (msg.channel.category or msg.channel).id # type: ignore
return (
msg.channel.category.id
if isinstance(msg.channel, discord.abc.GuildChannel)
and msg.channel.category
else msg.channel.id
)
elif self is BucketType.role:
# we return the channel id of a private-channel as there are only roles in guilds
# and that yields the same result as for a guild with only the @everyone role
Expand Down