Skip to content

Commit

Permalink
refactor(utilities): ignore auto complete in rate limit (#1070)
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayymmeena authored Sep 17, 2024
1 parent 06f4b5c commit 8933958
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions packages/utilities/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @discordx/utilities

## 7.0.3

### Patch Changes

- ignore auto complete in rate limit

## 7.0.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@discordx/utilities",
"version": "7.0.2",
"version": "7.0.3",
"private": false,
"description": "Utilities package for enhancing discordx functionality",
"keywords": [
Expand Down
10 changes: 5 additions & 5 deletions packages/utilities/src/guards/Rate Limiter/RateLimit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ export function RateLimit<T extends CommandInteraction | SimpleCommandMessage>(
}

return async function (arg, client, next) {
let memberId: string | null | undefined;
let guildId: string | null;
let memberId: string | null = null;
let guildId: string | null = null;

if (arg instanceof SimpleCommandMessage) {
memberId = arg.message.member?.id;
memberId = arg.message.member?.id ?? null;
guildId = arg.message.guildId;
} else {
memberId = arg.member?.user.id;
} else if (!arg.isAutocomplete()) {
memberId = arg.member?.user.id ?? null;
guildId = arg.guildId;
}

Expand Down

0 comments on commit 8933958

Please sign in to comment.