detritus-client
Version:
A Typescript NodeJS library to interact with Discord's API, both Rest and Gateway.
128 lines (127 loc) • 5.4 kB
TypeScript
import { RequestTypes } from 'detritus-client-rest';
import { ShardClient } from '../client';
import { BaseCollection } from '../collections/basecollection';
import { BaseSet } from '../collections/baseset';
import { ApplicationCommandOptionTypes, ApplicationCommandTypes, InteractionTypes, MessageComponentTypes } from '../constants';
import { BaseStructure, BaseStructureData } from './basestructure';
import { Channel } from './channel';
import { Guild } from './guild';
import { Member } from './member';
import { Message } from './message';
import { Role } from './role';
import { User } from './user';
export declare type InteractionEditOrRespond = RequestTypes.CreateInteractionResponseInnerPayload & RequestTypes.EditWebhookTokenMessage;
/**
* Interaction Structure
* @category Structure
*/
export declare class Interaction extends BaseStructure {
readonly _keys: BaseSet<string>;
readonly _keysMerge: BaseSet<string>;
readonly _deleted: boolean;
applicationId: string;
channelId?: string;
data?: InteractionDataApplicationCommand | InteractionDataComponent;
guildId?: string;
id: string;
member?: Member;
message?: Message;
responded: boolean;
responseDeleted?: boolean;
responseId?: string;
token: string;
type: InteractionTypes;
user: User;
version: number;
constructor(client: ShardClient, data?: BaseStructureData, isClone?: boolean);
get channel(): Channel | null;
get createdAt(): Date;
get createdAtUnix(): number;
get deleted(): boolean;
get guild(): Guild | null;
get inDm(): boolean;
get isFromApplicationCommand(): boolean;
get isFromMessageComponent(): boolean;
get response(): Message | null;
get userId(): string;
createMessage(options?: RequestTypes.ExecuteWebhook | string): Promise<Message | null>;
createResponse(options: RequestTypes.CreateInteractionResponse | number, data?: RequestTypes.CreateInteractionResponseInnerPayload | string): Promise<any>;
deleteMessage(messageId: string): Promise<any>;
deleteResponse(): Promise<any>;
editMessage(messageId: string, options?: RequestTypes.EditWebhookTokenMessage): Promise<Message>;
editResponse(options?: RequestTypes.EditWebhookTokenMessage): Promise<Message>;
editOrRespond(options?: InteractionEditOrRespond | string): Promise<any>;
fetchMessage(messageId: string): Promise<Message>;
fetchResponse(): Promise<Message>;
reply(options?: RequestTypes.ExecuteWebhook | string): Promise<Message | null>;
respond(options: RequestTypes.CreateInteractionResponse | number, data?: RequestTypes.CreateInteractionResponseInnerPayload | string): Promise<any>;
mergeValue(key: string, value: any): void;
}
/**
* Interaction Data Application Command Structure
* @category Structure
*/
export declare class InteractionDataApplicationCommand extends BaseStructure {
readonly _keys: BaseSet<string>;
readonly interaction: Interaction;
id: string;
name: string;
options?: BaseCollection<string, InteractionDataApplicationCommandOption>;
resolved?: InteractionDataApplicationCommandResolved;
targetId?: string;
type: ApplicationCommandTypes;
constructor(interaction: Interaction, data?: BaseStructureData, isClone?: boolean);
get fullName(): string;
get isContextCommand(): boolean;
get isContextCommandMessage(): boolean;
get isContextCommandUser(): boolean;
get isSlashCommand(): boolean;
mergeValue(key: string, value: any): void;
toString(): string;
}
/**
* Interaction Data Application Command Option Structure
* @category Structure
*/
export declare class InteractionDataApplicationCommandOption extends BaseStructure {
readonly _keys: BaseSet<string>;
readonly interactionData: InteractionDataApplicationCommand;
name: string;
options?: BaseCollection<string, InteractionDataApplicationCommandOption>;
type: ApplicationCommandOptionTypes;
value?: boolean | number | string;
constructor(interactionData: InteractionDataApplicationCommand, data?: BaseStructureData, isClone?: boolean);
get fullName(): string;
get isSubCommand(): boolean;
get isSubCommandGroup(): boolean;
mergeValue(key: string, value: any): void;
}
/**
* Interaction Data Application Command Resolved Structure
* @category Structure
*/
export declare class InteractionDataApplicationCommandResolved extends BaseStructure {
readonly _keys: BaseSet<string>;
readonly _keysMerge: BaseSet<string>;
readonly interactionData: InteractionDataApplicationCommand;
channels?: BaseCollection<string, Channel>;
members?: BaseCollection<string, Member>;
messages?: BaseCollection<string, Message>;
roles?: BaseCollection<string, Role>;
users?: BaseCollection<string, User>;
constructor(interactionData: InteractionDataApplicationCommand, data?: BaseStructureData, isClone?: boolean);
get guildId(): string | null;
mergeValue(key: string, value: any): void;
}
/**
* Interaction Data Component Structure
* @category Structure
*/
export declare class InteractionDataComponent extends BaseStructure {
readonly _keys: BaseSet<string>;
readonly interaction: Interaction;
componentType: MessageComponentTypes;
customId: string;
values?: Array<string>;
constructor(interaction: Interaction, data?: BaseStructureData, isClone?: boolean);
}