Skip to main content
Module

x/harmony/mod.ts>Command

An easy to use Discord API Library for Deno.
Latest
class Command
implements CommandOptions
import { Command } from "https://deno.land/x/harmony@v2.9.0/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
cooldown: number

Cooldown in MS

optional
description: string
optional
dmOnly: boolean
optional
examples: string | string[]
optional
extension: Extension
optional
globalCooldown: number

Global command cooldown in MS

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