Skip to content

fix: rely on guild id instead of guild for buckets #1541

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? No Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2023
Merged
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
6 changes: 3 additions & 3 deletions interactions/models/internal/cooldowns.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ async def get_key(self, context: "BaseContext") -> Any:
if self is Buckets.USER:
return context.author.id
if self is Buckets.GUILD:
return context.guild_id if context.guild else context.author.id
return context.guild_id or context.author.id
if self is Buckets.CHANNEL:
return context.channel.id
if self is Buckets.MEMBER:
return (context.guild_id, context.author.id) if context.guild else context.author.id
return (context.guild_id, context.author.id) if context.guild_id else context.author.id
if self is Buckets.CATEGORY:
return await context.channel.parent_id if context.channel.parent else context.channel.id
if self is Buckets.ROLE:
return context.author.top_role.id if context.guild else context.channel.id
return context.author.top_role.id if context.guild_id else context.channel.id
return context.author.id

def __call__(self, context: "BaseContext") -> Any:
Expand Down