[commands] Fix issue with category cooldowns outside of guild channels

This commit is contained in:
Josh 2024-10-10 07:51:00 +10:00 committed by GitHub
parent 1ad45f585f
commit 0ce75f3f53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -71,7 +71,7 @@ class BucketType(Enum):
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 (getattr(msg.channel, 'category', None) or 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