16 lines
627 B
TypeScript
16 lines
627 B
TypeScript
import { type ChatInputApplicationCommandStructure } from '@projectdysnomia/dysnomia';
|
|
import type { ExecutableInteraction } from '../types/interaction.type';
|
|
import type { ChatCommandDefinition, CommandContext, CommandHandler } from '../types';
|
|
|
|
export function createChatCommand(
|
|
definition: ChatCommandDefinition,
|
|
execute: (interaction: ExecutableInteraction, ctx: CommandContext) => Promise<void>,
|
|
): CommandHandler<ChatInputApplicationCommandStructure> {
|
|
const def = definition as ChatInputApplicationCommandStructure;
|
|
def.type = 1; // CHAT_INPUT
|
|
return {
|
|
definition: def,
|
|
execute,
|
|
};
|
|
}
|