mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-01 16:30:08 +00:00
* Migrate eslint and prettier to biomejs This does NOT include examples/bigbot as it has its own formatter * Update to biome 1.8.0 * Readd dotenv dev dependency to rest During a merge it got lost
27 lines
732 B
TypeScript
27 lines
732 B
TypeScript
import { type ApplicationCommandOption, type ApplicationCommandTypes, Collection, type Interaction } from '@discordeno/bot'
|
|
|
|
export const commands = new Collection<string, Command>()
|
|
|
|
export function createCommand(command: Command): void {
|
|
commands.set(command.name, command)
|
|
}
|
|
|
|
export interface Command {
|
|
name: string
|
|
description: string
|
|
usage?: string[]
|
|
options?: ApplicationCommandOption[]
|
|
type: ApplicationCommandTypes
|
|
/** Defaults to `Guild` */
|
|
scope?: 'Global' | 'Guild'
|
|
execute: (interaction: Interaction) => unknown
|
|
subcommands?: Array<SubCommandGroup | SubCommand>
|
|
}
|
|
|
|
export type SubCommand = Omit<Command, 'subcommands'>
|
|
|
|
export interface SubCommandGroup {
|
|
name: string
|
|
subCommands: SubCommand[]
|
|
}
|