diff --git a/bot.ts b/bot.ts index cb44c2ddd..b7be6f2f8 100644 --- a/bot.ts +++ b/bot.ts @@ -421,7 +421,7 @@ export interface Transformers { user: (bot: Bot, payload: User) => DiscordUser; team: (bot: Bot, payload: Team) => DiscordTeam; application: (bot: Bot, payload: Application) => DiscordApplication; - snowflake: (snowflake: bigint) => string; + snowflake: (snowflake: BigString) => string; createApplicationCommand: (bot: Bot, payload: CreateApplicationCommand) => DiscordCreateApplicationCommand; applicationCommand: (bot: Bot, payload: ApplicationCommand) => DiscordApplicationCommand; applicationCommandOption: (bot: Bot, payload: ApplicationCommandOption) => DiscordApplicationCommandOption; diff --git a/plugins/permissions/src/permissions.ts b/plugins/permissions/src/permissions.ts index d20b14ae9..c74b7b1d6 100644 --- a/plugins/permissions/src/permissions.ts +++ b/plugins/permissions/src/permissions.ts @@ -18,7 +18,9 @@ export function calculateBasePermissions( memberOrId: bigint | Member, ) { const guild = typeof guildOrId === "bigint" ? bot.guilds.get(guildOrId) : guildOrId; - const member = typeof memberOrId === "bigint" ? bot.members.get(bot.transformers.snowflake(`${memberOrId}${guild?.id}`)) : memberOrId; + const member = typeof memberOrId === "bigint" + ? bot.members.get(bot.transformers.snowflake(`${memberOrId}${guild?.id}`)) + : memberOrId; if (!guild || !member) return 8n; diff --git a/rest/cleanupQueues.ts b/rest/cleanupQueues.ts index 709511ab3..8f4711ae3 100644 --- a/rest/cleanupQueues.ts +++ b/rest/cleanupQueues.ts @@ -30,6 +30,6 @@ export function isQueueClearable(queue: QueueBucket) { if (!queue.interval) return false; if (queue.processing) return false; if (queue.processingPending) return false; - + return true; } diff --git a/rest/createInvalidRequestBucket.ts b/rest/createInvalidRequestBucket.ts index 340d6d8aa..90654593e 100644 --- a/rest/createInvalidRequestBucket.ts +++ b/rest/createInvalidRequestBucket.ts @@ -72,7 +72,7 @@ export function createInvalidRequestBucket(options: InvalidRequestBucketOptions) if (!bucket.errorStatuses.includes(code)) return; // Shared scope is not considered invalid if (code === 429 && sharedScope) return; - + // INVALID REQUEST WAS MADE // If it was not frozen before, mark it frozen diff --git a/rest/createQueueBucket.ts b/rest/createQueueBucket.ts index 7db5c0e15..3440c2878 100644 --- a/rest/createQueueBucket.ts +++ b/rest/createQueueBucket.ts @@ -70,9 +70,7 @@ export function createQueueBucket(rest: RestManager, options: QueueBucketOptions bucket.processingPending = true; while (bucket.pending.length) { - if (bucket.firstRequest || bucket.isRequestAllowed()) { - const [queuedRequest] = bucket.pending; if (queuedRequest) { const basicURL = rest.simplifyUrl(queuedRequest.request.url, queuedRequest.request.method); diff --git a/rest/processGlobalQueue.ts b/rest/processGlobalQueue.ts index c31af0c5b..e41d3f907 100644 --- a/rest/processGlobalQueue.ts +++ b/rest/processGlobalQueue.ts @@ -1,4 +1,4 @@ -import { RestRequest,RestPayload } from "./rest.ts"; +import { RestPayload, RestRequest } from "./rest.ts"; import { RestManager } from "./restManager.ts"; export async function processGlobalQueue(rest: RestManager, request: { diff --git a/rest/sendRequest.ts b/rest/sendRequest.ts index d21ce83af..7f5381db4 100644 --- a/rest/sendRequest.ts +++ b/rest/sendRequest.ts @@ -97,7 +97,10 @@ export async function sendRequest(rest: RestManager, options: RestSendRequest return; } // RATE LIMITED, ADD BACK TO QUEUE else { - rest.invalidBucket.handleCompletedRequest(response.status, response.headers.get('X-RateLimit-Scope') === 'shared'); + rest.invalidBucket.handleCompletedRequest( + response.status, + response.headers.get("X-RateLimit-Scope") === "shared", + ); await delay(json.retry_after * 1000); return options.retryRequest?.(); } diff --git a/types/discord.ts b/types/discord.ts index 414e10597..427c06830 100644 --- a/types/discord.ts +++ b/types/discord.ts @@ -30,6 +30,7 @@ import { ScheduledEventEntityType, ScheduledEventPrivacyLevel, ScheduledEventStatus, + SortOrderTypes, StickerFormatTypes, StickerTypes, SystemChannelFlags, diff --git a/util/bigint.ts b/util/bigint.ts index 8c9f50736..8354c50b1 100644 --- a/util/bigint.ts +++ b/util/bigint.ts @@ -4,6 +4,6 @@ export function snowflakeToBigint(snowflake: BigString) { return BigInt(snowflake) | 0n; } -export function bigintToSnowflake(snowflake: bigint) { +export function bigintToSnowflake(snowflake: BigString) { return snowflake === 0n ? "" : snowflake.toString(); }