UNPKG

seyfert

Version:

The most advanced framework for discord bots

50 lines (49 loc) 3.75 kB
import type { ContextMenuCommand, InteractionGuildMemberStructure, ReturnCache } from '../..'; import { type GuildMemberStructure, type GuildStructure, type MessageStructure, type UserStructure, type WebhookMessageStructure } from '../../client/transformers'; import { type InteractionCreateBodyRequest, type InteractionMessageUpdateBodyRequest, type MakeRequired, type ModalCreateBodyRequest, type UnionToTuple, type When } from '../../common'; import type { AllChannels, MessageCommandInteraction, UserCommandInteraction } from '../../structures'; import { BaseContext } from '../basecontext'; import type { RegisteredMiddlewares } from '../decorators'; import type { CommandMetadata, ExtendContext, GlobalMetadata, UsingClient } from './shared'; export type InteractionTarget<T> = T extends MessageCommandInteraction ? MessageStructure : UserStructure; export interface MenuCommandContext<T extends MessageCommandInteraction | UserCommandInteraction, M extends keyof RegisteredMiddlewares = never> extends BaseContext, ExtendContext { } export declare class MenuCommandContext<T extends MessageCommandInteraction | UserCommandInteraction, M extends keyof RegisteredMiddlewares = never> extends BaseContext { readonly client: UsingClient; readonly interaction: T; readonly shardId: number; readonly command: ContextMenuCommand; constructor(client: UsingClient, interaction: T, shardId: number, command: ContextMenuCommand); metadata: CommandMetadata<UnionToTuple<M>>; globalMetadata: GlobalMetadata; get target(): InteractionTarget<T>; get t(): import("../..").__InternalParseLocale<import("./shared").DefaultLocale> & { get(locale?: string): import("./shared").DefaultLocale; }; get fullCommandName(): string; write<WR extends boolean = false>(body: InteractionCreateBodyRequest, withResponse?: WR): Promise<When<WR, WebhookMessageStructure, void>>; modal(body: ModalCreateBodyRequest): Promise<undefined>; deferReply<WR extends boolean = false>(ephemeral?: boolean, withResponse?: WR): Promise<When<WR, WebhookMessageStructure, undefined>>; editResponse(body: InteractionMessageUpdateBodyRequest): Promise<WebhookMessageStructure>; deleteResponse(): Promise<void>; editOrReply<WR extends boolean = false>(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest, withResponse?: WR): Promise<When<WR, WebhookMessageStructure, void>>; fetchResponse(): Promise<WebhookMessageStructure>; channel(mode?: 'rest' | 'flow'): Promise<AllChannels>; channel(mode: 'cache'): ReturnCache<AllChannels>; me(mode?: 'rest' | 'flow'): Promise<GuildMemberStructure>; me(mode: 'cache'): ReturnCache<GuildMemberStructure | undefined>; guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'> | undefined>; guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>; get guildId(): string | undefined; get channelId(): string; get author(): UserStructure; get member(): InteractionGuildMemberStructure | undefined; isMenu(): this is MenuCommandContext<UserCommandInteraction | MessageCommandInteraction>; isMenuUser(): this is MenuCommandContext<UserCommandInteraction>; isMenuMessage(): this is MenuCommandContext<MessageCommandInteraction>; inGuild(): this is GuildMenuCommandContext<T, M>; } export interface GuildMenuCommandContext<T extends MessageCommandInteraction | UserCommandInteraction, M extends keyof RegisteredMiddlewares = never> extends Omit<MakeRequired<MenuCommandContext<T, M>, 'guildId' | 'member'>, 'guild'> { guild(mode?: 'rest' | 'flow'): Promise<GuildStructure<'cached' | 'api'>>; guild(mode: 'cache'): ReturnCache<GuildStructure<'cached'> | undefined>; }