Files
discordeno/examples/beginner/src/commands.ts
Fleny 919474069d chore: Migrate ESLint and prettier to Biome (#3634)
* 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
2024-07-13 13:05:02 -05:00

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[]
}