Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/harmony/src/commands/mod.ts>Command

An easy to use Discord API Library for Deno.
Go to Latest
class Command
implements CommandOptions
Re-export
import { Command } from "https://deno.land/x/harmony@v2.8.0/src/commands/mod.ts";

Constructors

new
Command()

Properties

readonly
optional
_decoratedSubCommands: Command[]
optional
aliases: string | string[]
optional
args: Args[]
optional
botPermissions: string | string[]
optional
category: string
optional
description: string
optional
dmOnly: boolean
optional
examples: string | string[]
optional
extension: Extension
optional
guildOnly: boolean
name: string
optional
nsfw: boolean
optional
optionalArgs: boolean
optional
ownerOnly: boolean
optional
permissions: string | string[]
optional
roles: string | string[]
optional
subCommands: Command[]
optional
usage: string | string[]
optional
userPermissions: string | string[]
optional
whitelistedChannels: string | string[]
optional
whitelistedGuilds: string | string[]
optional
whitelistedUsers: string | string[]

Methods

afterExecute<T>(ctx: CommandContext, executeResult: T): unknown | Promise<unknown>

Method executed after executing command, passes on CommandContext and the value returned by execute too. (optional)

beforeExecute(ctx: CommandContext):
| boolean
| Promise<boolean>
| unknown
| Promise<unknown>

Method executed before executing actual command. Returns bool value - whether to continue or not (optional)

execute(ctx: CommandContext): unknown | Promise<unknown>

Actual command code, which is executed when all checks have passed.

Get an Array of Sub Commands, including decorated ones

onError(ctx: CommandContext, error: Error): unknown | Promise<unknown>

Method called when the command errors

onMissingArgs(ctx: CommandContext): unknown | Promise<unknown>

Method called when there are missing arguments

toString(): string