Browse Source

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

pull/9963/head
Josh 6 months ago
committed by GitHub
parent
commit
0ce75f3f53
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      discord/ext/commands/cooldowns.py

2
discord/ext/commands/cooldowns.py

@ -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

Loading…
Cancel
Save