@dexare/slash-create
Version:
A Dexare module that uses slash-create to make slash commands
48 lines (47 loc) • 1.82 kB
TypeScript
import { DexareModule, DexareClient, BaseConfig } from 'dexare';
import { InteractionRequestData, SlashCreator } from 'slash-create';
import Collection from '@discordjs/collection';
import SlashableDexareCommand from './command';
import { SyncCommandOptions } from './types';
import { RespondFunction } from 'slash-create/lib/server';
export interface SlashCreateConfig extends BaseConfig {
slashCreate: SlashCreateModuleOptions;
}
export interface SlashCreateModuleOptions {
applicationID: string;
token?: string;
publicKey?: string;
endpointPath?: string;
serverPort?: number;
serverHost?: string;
maxSignatureTimestamp?: number;
unknownCommandResponse?: boolean;
}
export { SlashableDexareCommand };
export default class SlashCreateModule<T extends DexareClient<any>> extends DexareModule<T> {
creator: SlashCreator;
constructor(client: T);
load(): void;
unload(): void;
onCommand(interaction: InteractionRequestData, respond: RespondFunction, webserverMode: boolean): Promise<any>;
/**
* Sync guild commands.
* @param guildID The guild to sync
* @param deleteCommands Whether to delete command not found in the creator
*/
sync(opts?: SyncCommandOptions): Promise<void>;
/**
* Sync global commands.
* @param deleteCommands Whether to delete command not found in the creator
*/
syncGlobal(deleteCommands?: boolean): Promise<void>;
/**
* Sync guild commands.
* @param guildID The guild to sync
* @param deleteCommands Whether to delete command not found in the creator
*/
syncGuild(guildID: string, deleteCommands?: boolean): Promise<void>;
getSlashableCommands(): Collection<string, SlashableDexareCommand>;
private syncMockCommands;
private getCommandFromInteraction;
}