slash-create-modify
Version:
Create and sync Discord slash commands!
75 lines (74 loc) • 3.32 kB
TypeScript
import { RespondFunction } from '../../server';
import { SlashCreator } from '../../creator';
import { AnyCommandOption, ApplicationCommandType, AttachmentData, InteractionRequestData } from '../../constants';
import { User } from '../user';
import { Collection } from '../../util/collection';
import { Channel } from '../channel';
import { Role } from '../role';
import { ResolvedMember } from '../resolvedMember';
import { Message } from '../message';
import { ModalSendableContext } from './modalSendableContext';
/** Context representing a command interaction. */
export declare class CommandContext extends ModalSendableContext {
/** The full interaction data. */
readonly data: InteractionRequestData;
/** The command's type. */
readonly commandType: ApplicationCommandType;
/** The command's name. */
readonly commandName: string;
/** The command's ID. */
readonly commandID: string;
/** The ID of the target user/message. */
readonly targetID?: string;
/** The options given to the command. */
readonly options: {
[key: string]: any;
};
/** The subcommands the member used in order. */
readonly subcommands: string[];
/** The resolved users of the interaction. */
readonly users: Collection<string, User>;
/** The resolved members of the interaction. */
readonly members: Collection<string, ResolvedMember>;
/** The resolved roles of the interaction. */
readonly roles: Collection<string, Role>;
/** The resolved channels of the interaction. */
readonly channels: Collection<string, Channel>;
/** The resolved messages of the interaction. */
readonly messages: Collection<string, Message>;
/** The resolved attachments of the interaction. */
readonly attachments: Collection<string, AttachmentData>;
/** Whether the context is from a webserver. */
private webserverMode;
/**
* @param creator The instantiating creator.
* @param data The interaction data for the context.
* @param respond The response function for the interaction.
* @param webserverMode Whether the interaction was from a webserver.
* @param deferEphemeral Whether the context should auto-defer ephemeral messages.
* @param useTimeout Whether to use the deferral timeout.
*/
constructor(creator: SlashCreator, data: InteractionRequestData, respond: RespondFunction, webserverMode: boolean, deferEphemeral?: boolean, useTimeout?: boolean);
/**
* The target message of the interaction.
* Will be `null` if it's not from a message command.
*/
get targetMessage(): Message | null | undefined;
/**
* The target user of the interaction.
* Will be `null` if it's not from a user command.
*/
get targetUser(): User | null | undefined;
/**
* The target member of the interaction.
* Will be `null` if it's not from a user command.
*/
get targetMember(): ResolvedMember | null | undefined;
/** @private */
static convertOptions(options: AnyCommandOption[]): {
[key: string]: any;
};
/** @private */
static getSubcommandArray(options: AnyCommandOption[]): string[];
}
export declare const Context: typeof CommandContext;