Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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 not working in DMs
([#2603](https://github.com/Pycord-Development/pycord/pull/2603))

### Changed

Expand Down
7 changes: 6 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,11 @@ 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
if isinstance(msg.channel, discord.abc.GuildChannel)
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