@beni69/cmd
Version:
The command handler from my discord bot
50 lines • 2.28 kB
TypeScript
import { Client, CommandInteraction, CommandInteractionOptionResolver, DMChannel, Guild, GuildMember, InteractionReplyOptions, Message, MessagePayload, NewsChannel, ReplyMessageOptions, Snowflake, TextChannel, User } from "discord.js";
import Command from "./Command";
import Handler from "./Handler";
export declare class Trigger {
readonly handler: Handler;
readonly command: Command;
readonly source: Message | CommandInteraction;
protected opts: TriggerOptions;
private response?;
id: Snowflake;
client: Client;
guild: Guild | null;
channel: TextChannel | DMChannel | NewsChannel;
member: GuildMember | null;
createdAt: Date;
author: User;
content: string;
argv: CommandInteractionOptionResolver;
createdTimestamp: number;
error?: Error;
constructor(handler: Handler, command: Command, source: Message | CommandInteraction);
get args(): any[];
isClassic: () => this is ClassicTrigger;
isSlash: () => this is SlashTrigger;
reply: (msg: string | MessagePayload | (ReplyMessageOptions & InteractionReplyOptions)) => Promise<Message<boolean> | (import("discord-api-types").APIMessage & void) | undefined>;
fetchReply: () => Promise<Message<boolean> | undefined>;
edit: (msg: string | MessagePayload) => Promise<import("discord-api-types").APIMessage | Message<boolean>> | undefined;
followUp: (msg: string | MessagePayload | (ReplyMessageOptions & InteractionReplyOptions)) => Promise<import("discord-api-types").APIMessage | Message<boolean>> | undefined;
private args2Opt;
private args2Yargs;
}
export interface ClassicTrigger extends Trigger {
source: Message;
args: string[];
fetchReply: () => Promise<Message>;
reply: (msg: string | MessagePayload | ReplyMessageOptions) => Promise<Message>;
edit: (msg: string | MessagePayload | ReplyMessageOptions) => Promise<Message>;
}
export interface SlashTrigger extends Trigger {
source: CommandInteraction;
fetchReply: () => Promise<Message>;
reply: (msg: string | MessagePayload | InteractionReplyOptions) => Promise<undefined>;
edit: any;
}
export declare type TriggerOptions = {
ephemeral: boolean;
deferred: boolean;
};
export default Trigger;
//# sourceMappingURL=Trigger.d.ts.map