From 404f23f76ee248e91a5817daf9b245ef171b27d1 Mon Sep 17 00:00:00 2001 From: MARCROCK22 Date: Fri, 27 Dec 2024 11:08:01 -0400 Subject: [PATCH] fix: transformers types --- src/cache/index.ts | 37 ++++++++++++++++------- src/commands/applications/entrycontext.ts | 2 +- src/structures/GuildMember.ts | 2 +- src/structures/Interaction.ts | 3 +- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/cache/index.ts b/src/cache/index.ts index 3fed020..0efe9c9 100644 --- a/src/cache/index.ts +++ b/src/cache/index.ts @@ -5,16 +5,6 @@ import type { Adapter } from './adapters'; import { Guilds } from './resources/guilds'; import { Users } from './resources/users'; -import { Bans } from './resources/bans'; -import { Channels } from './resources/channels'; -import { Emojis } from './resources/emojis'; -import { Members } from './resources/members'; -import { Presences } from './resources/presence'; -import { Roles } from './resources/roles'; -import { StageInstances } from './resources/stage-instances'; -import { Stickers } from './resources/stickers'; -import { VoiceStates } from './resources/voice-states'; - import type { InternalOptions, UsingClient } from '../commands'; import { type APIChannel, @@ -30,8 +20,17 @@ import { GuildMemberFlags, OverwriteType, } from '../types'; +import { Bans } from './resources/bans'; +import { Channels } from './resources/channels'; +import { Emojis } from './resources/emojis'; +import { Members } from './resources/members'; import { Messages } from './resources/messages'; import { Overwrites } from './resources/overwrites'; +import { Presences } from './resources/presence'; +import { Roles } from './resources/roles'; +import { StageInstances } from './resources/stage-instances'; +import { Stickers } from './resources/stickers'; +import { VoiceStates } from './resources/voice-states'; export { BaseResource } from './resources/default/base'; export { GuildBasedResource } from './resources/default/guild-based'; export { GuildRelatedResource } from './resources/default/guild-related'; @@ -219,7 +218,23 @@ export class Cache { string, ] )[], - ) { + ): Promise< + Partial<{ + messages: ReturnManagers['messages'][]; + users: ReturnManagers['users'][]; + guilds: ReturnManagers['guilds'][]; + members: ReturnManagers['members'][]; + voiceStates: ReturnManagers['voiceStates'][]; + emojis: ReturnManagers['emojis'][]; + roles: ReturnManagers['roles'][]; + channels: ReturnManagers['channels'][]; + stickers: ReturnManagers['stickers'][]; + presences: ReturnManagers['presences'][]; + stageInstances: ReturnManagers['stageInstances'][]; + overwrites: ReturnManagers['overwrites'][]; + bans: ReturnManagers['bans'][]; + }> + > { const allData: Partial> = {}; for (const [type, id, guildId] of keys) { switch (type) { diff --git a/src/commands/applications/entrycontext.ts b/src/commands/applications/entrycontext.ts index 0f5d249..ec8461b 100644 --- a/src/commands/applications/entrycontext.ts +++ b/src/commands/applications/entrycontext.ts @@ -77,7 +77,7 @@ export class EntryPointContext ex return this.interaction.editOrReply(body as InteractionCreateBodyRequest, withResponse); } - fetchResponse() { + fetchResponse(): Promise { return this.interaction.fetchResponse(); } diff --git a/src/structures/GuildMember.ts b/src/structures/GuildMember.ts index 99b4353..f723de7 100644 --- a/src/structures/GuildMember.ts +++ b/src/structures/GuildMember.ts @@ -137,7 +137,7 @@ export class BaseGuildMember extends DiscordBase { ban: (id: string, body?: RESTPutAPIGuildBanJSONBody, reason?: string) => client.members.ban(guildId, id, body, reason), kick: (id: string, reason?: string) => client.members.kick(guildId, id, reason), - edit: (id: string, body: RESTPatchAPIGuildMemberJSONBody, reason?: string) => + edit: (id: string, body: RESTPatchAPIGuildMemberJSONBody, reason?: string): Promise => client.members.edit(guildId, id, body, reason), add: (id: string, body: RESTPutAPIGuildMemberJSONBody): Promise => client.members.add(guildId, id, body), diff --git a/src/structures/Interaction.ts b/src/structures/Interaction.ts index 6b57dbe..2b63e97 100644 --- a/src/structures/Interaction.ts +++ b/src/structures/Interaction.ts @@ -47,6 +47,7 @@ import { ActionRow, Embed, Modal, PollBuilder, resolveAttachment, resolveFiles } import { type EntitlementStructure, type GuildRoleStructure, + type GuildStructure, type InteractionGuildMemberStructure, type MessageStructure, type OptionResolverStructure, @@ -363,7 +364,7 @@ export class BaseInteraction< } } - async fetchGuild(force = false) { + async fetchGuild(force = false): Promise | undefined> { return this.guildId ? this.client.guilds.fetch(this.guildId, force) : undefined; } }