diff --git a/src/util/cache.ts b/src/util/cache.ts index c3be7a26c..61fa1a7ba 100644 --- a/src/util/cache.ts +++ b/src/util/cache.ts @@ -10,9 +10,14 @@ export interface CacheData { members: Collection; unavailableGuilds: Collection; presences: Collection; - // TODO: The type Collection's second provided generic [function] should have a definite shape. - // deno-lint-ignore ban-types - fetchAllMembersProcessingRequests: Collection; + fetchAllMembersProcessingRequests: Collection< + string, + ( + value: + | Collection + | PromiseLike>, + ) => void + >; executedSlashCommands: Collection; } diff --git a/src/ws/shard_manager.ts b/src/ws/shard_manager.ts index 4692632f4..4d92625fa 100644 --- a/src/ws/shard_manager.ts +++ b/src/ws/shard_manager.ts @@ -1,5 +1,6 @@ import { controllers } from "../api/controllers/mod.ts"; import { Guild } from "../api/structures/guild.ts"; +import { Member } from "../api/structures/mod.ts"; import { eventHandlers, IdentifyPayload } from "../bot.ts"; import { DiscordBotGatewayData, @@ -8,6 +9,7 @@ import { GatewayOpcode, } from "../types/mod.ts"; import { cache } from "../util/cache.ts"; +import { Collection } from "../util/collection.ts"; import { BotStatusRequest, delay } from "../util/utils.ts"; import { botGatewayStatusRequest, @@ -90,9 +92,9 @@ export async function handleDiscordPayload( export function requestAllMembers( guild: Guild, - // TODO: The parameter "resolve" should have a "stronger" type. - // deno-lint-ignore ban-types - resolve: Function, + resolve: ( + value: Collection | PromiseLike>, + ) => void, options?: FetchMembersOptions, ) { const nonce = `${guild.id}-${Date.now()}`;