Skip to content

Commit faeb369

Browse files
committed
fix: category cooldown works in dms like other guild cooldowns
1 parent 6c384c7 commit faeb369

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

discord/ext/commands/cooldowns.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from collections import deque
3131
from typing import TYPE_CHECKING, Any, Callable, Deque, TypeVar
3232

33+
import discord.abc
3334
from discord.enums import Enum
3435

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

0 commit comments

Comments
 (0)