fix: transformers types

This commit is contained in:
MARCROCK22 2024-12-27 11:08:01 -04:00
parent 24c2749b15
commit 404f23f76e
4 changed files with 30 additions and 14 deletions

37
src/cache/index.ts vendored
View File

@ -5,16 +5,6 @@ import type { Adapter } from './adapters';
import { Guilds } from './resources/guilds'; import { Guilds } from './resources/guilds';
import { Users } from './resources/users'; 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 { InternalOptions, UsingClient } from '../commands';
import { import {
type APIChannel, type APIChannel,
@ -30,8 +20,17 @@ import {
GuildMemberFlags, GuildMemberFlags,
OverwriteType, OverwriteType,
} from '../types'; } 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 { Messages } from './resources/messages';
import { Overwrites } from './resources/overwrites'; 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 { BaseResource } from './resources/default/base';
export { GuildBasedResource } from './resources/default/guild-based'; export { GuildBasedResource } from './resources/default/guild-based';
export { GuildRelatedResource } from './resources/default/guild-related'; export { GuildRelatedResource } from './resources/default/guild-related';
@ -219,7 +218,23 @@ export class Cache {
string, 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<Record<NonGuildBased | GuildBased | GuildRelated, string[][]>> = {}; const allData: Partial<Record<NonGuildBased | GuildBased | GuildRelated, string[][]>> = {};
for (const [type, id, guildId] of keys) { for (const [type, id, guildId] of keys) {
switch (type) { switch (type) {

View File

@ -77,7 +77,7 @@ export class EntryPointContext<M extends keyof RegisteredMiddlewares = never> ex
return this.interaction.editOrReply<WR>(body as InteractionCreateBodyRequest, withResponse); return this.interaction.editOrReply<WR>(body as InteractionCreateBodyRequest, withResponse);
} }
fetchResponse() { fetchResponse(): Promise<WebhookMessageStructure> {
return this.interaction.fetchResponse(); return this.interaction.fetchResponse();
} }

View File

@ -137,7 +137,7 @@ export class BaseGuildMember extends DiscordBase {
ban: (id: string, body?: RESTPutAPIGuildBanJSONBody, reason?: string) => ban: (id: string, body?: RESTPutAPIGuildBanJSONBody, reason?: string) =>
client.members.ban(guildId, id, body, reason), client.members.ban(guildId, id, body, reason),
kick: (id: string, reason?: string) => client.members.kick(guildId, id, 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<GuildMemberStructure> =>
client.members.edit(guildId, id, body, reason), client.members.edit(guildId, id, body, reason),
add: (id: string, body: RESTPutAPIGuildMemberJSONBody): Promise<GuildMemberStructure | undefined> => add: (id: string, body: RESTPutAPIGuildMemberJSONBody): Promise<GuildMemberStructure | undefined> =>
client.members.add(guildId, id, body), client.members.add(guildId, id, body),

View File

@ -47,6 +47,7 @@ import { ActionRow, Embed, Modal, PollBuilder, resolveAttachment, resolveFiles }
import { import {
type EntitlementStructure, type EntitlementStructure,
type GuildRoleStructure, type GuildRoleStructure,
type GuildStructure,
type InteractionGuildMemberStructure, type InteractionGuildMemberStructure,
type MessageStructure, type MessageStructure,
type OptionResolverStructure, type OptionResolverStructure,
@ -363,7 +364,7 @@ export class BaseInteraction<
} }
} }
async fetchGuild(force = false) { async fetchGuild(force = false): Promise<GuildStructure<'api'> | undefined> {
return this.guildId ? this.client.guilds.fetch(this.guildId, force) : undefined; return this.guildId ? this.client.guilds.fetch(this.guildId, force) : undefined;
} }
} }