Options
All
  • Public
  • Public/Protected
  • All
Menu

discord-bot-cli

Index

Definition Type aliases

ArgDefinition

ArgDefinition: ParsableDefinition & { optional?: undefined | false | true }

CommandDefinition

CommandDefinitionBase

CommandDefinitionBase: { aliases?: string[]; args?: Readonly<Record<string, ArgDefinition>>; canUse?: CanUseCommandHandler; clientPermissions?: PermissionString[]; description?: undefined | string; examples?: string[]; flags?: Readonly<Record<string, FlagDefinition>>; help?: HelpHandler; inherit?: undefined | false | true; rest?: RestDefinition; subs?: Readonly<Record<string, CommandDefinition>>; throttling?: ThrottlingDefinition | null; useHelpOnSubs?: undefined | false | true; useThrottlerForSubs?: undefined | false | true; userPermissions?: PermissionString[] }

Type declaration

  • Optional Readonly aliases?: string[]

    Aliases for this command.

  • Optional Readonly args?: Readonly<Record<string, ArgDefinition>>

    Arguments that must be passed to the command.

  • Optional Readonly canUse?: CanUseCommandHandler

    Determine if a user can use this commands. If the result is true, the command is executed. If the result is a string, the command is not executed and a reply message with the string is returned.

  • Optional Readonly clientPermissions?: PermissionString[]

    Define which permissions the bot's user require to perform the command.

  • Optional Readonly description?: undefined | string

    The description of this command. Used by help command.

  • Optional Readonly examples?: string[]

    A list of example for this command.

  • Optional Readonly flags?: Readonly<Record<string, FlagDefinition>>

    Flags that can be used with this command.

  • Optional Readonly help?: HelpHandler

    If defined, this callback is called when help is needed for this command instead of default help.

  • Optional Readonly inherit?: undefined | false | true

    Either or not undefined inheritable properties are inherited from parent command. (default is true).

  • Optional Readonly rest?: RestDefinition

    Define a name and a description for a rest argument. Used for help purpose.

  • Optional Readonly subs?: Readonly<Record<string, CommandDefinition>>

    Sub-commands of this command.

  • Optional Readonly throttling?: ThrottlingDefinition | null
  • Optional Readonly useHelpOnSubs?: undefined | false | true

    If set to true and help is defined, this command's help handler is used for sub command that not defined a help handler. (default is false)

  • Optional Readonly useThrottlerForSubs?: undefined | false | true

    Either or not sub-commands will use the same throttler as this command. (default is true)

  • Optional Readonly userPermissions?: PermissionString[]

    If the command is used from a guild, the user require these permissions to execute this command. Inherited from parent command if not defined.

CommandSettings

CommandSettings: { deleteMessage?: undefined | false | true; devOnly?: undefined | false | true; guildOnly?: undefined | false | true; ignore?: undefined | false | true }

Type declaration

  • Optional Readonly deleteMessage?: undefined | false | true

    Either or not the message that executed this command is deleted after the command execution. (default is false). [inheritable]

  • Optional Readonly devOnly?: undefined | false | true

    Either or not this command can only be used by dev (see CommandSetOptions.devIDs). (default is false). [inheritable]

  • Optional Readonly guildOnly?: undefined | false | true

    Either or not this command can only be used from a guild. (default is false). [inheritable]

  • Optional Readonly ignore?: undefined | false | true

    Either or not this command will be ignored. (default is false). [inheritable]

FlagDefinition

FlagDefinition: ParsableDefinition & { shortcut?: Char }

ParsableDefinition

ParsableDefinition: WrapParsable<ParsableTypeName> | Parsable<readonly ParsableTypeName[]>

Handler Type aliases

CanUseCommandHandler

CanUseCommandHandler: (user: User, message: Message) => boolean | string

Handler to determine if a user can use the command.

Type declaration

    • (user: User, message: Message): boolean | string
    • Parameters

      • user: User
      • message: Message

      Returns boolean | string

CommandExecutor

CommandExecutor<T, S>: (args: {}, flags: {}, others: { command: Command; commandSet: CommandSet; message: Message & MessageExtension<S>; options: CommandSetOptions; rest: undefined extends T["rest"] ? void : readonly ParsableTypeOf<NonNullable<T["rest"]>["type"]>[] } & MessageExtension<S>) => any | Promise<any>

Command's executor handler.

Type parameters

Type declaration

    • (args: {}, flags: {}, others: { command: Command; commandSet: CommandSet; message: Message & MessageExtension<S>; options: CommandSetOptions; rest: undefined extends T["rest"] ? void : readonly ParsableTypeOf<NonNullable<T["rest"]>["type"]>[] } & MessageExtension<S>): any | Promise<any>
    • Parameters

      • args: {}
      • flags: {}
      • others: { command: Command; commandSet: CommandSet; message: Message & MessageExtension<S>; options: CommandSetOptions; rest: undefined extends T["rest"] ? void : readonly ParsableTypeOf<NonNullable<T["rest"]>["type"]>[] } & MessageExtension<S>

      Returns any | Promise<any>

HelpHandler

HelpHandler: (command: Command, context: { commandSet: CommandSet; message: Message; options: CommandSetOptions }) => void | Promise<void>

Function called to generate help for a command.

Type declaration

Localization Type aliases

TypeNameLocalization

TypeNameLocalization: Record<ParsableTypeName, string>

Other Type aliases

BuildInCommand

BuildInCommand: "help" | "list" | "cmd"

CommandResult

CommandResult: { command: Command; result: any; status: "ok" } | { error: any; status: "error" } | { command: Command; status: "no executor" | "guild only" | "dev only" | "unauthorized user" | "throttling" | "client permissions" } | { status: "not prefixed" | "command not found" } | ({ status: "parsing error" } & ({ arg: Readonly<ArgDefinition>; type: "arg" } & { got: string; reason: "invalid value" } | { reason: "missing argument" }) | ({ type: "flag" } & { name: string; reason: "unknown flag" } | { flag: Readonly<FlagDefinition>; got: string; reason: "invalid value" }))

ParsableType

ParsableType: string | boolean | number | User | Role | Channel | GuildChannel | DMChannel | TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel

Parsable types.

ParsableTypeName

ParsableTypeName: "string" | "boolean" | "integer" | "float" | "user" | "role" | "channel" | "guild channel" | "dm channel" | "text channel" | "voice channel" | "category channel" | "news channel" | "store channel"

Name of parsable types.

PartialCommandSetOptions

PartialCommandSetOptions: DeepPartial<CommandSetOptions>

WrapParsable

WrapParsable<T>: T extends any ? Parsable<T> : never

Type parameters

Other Functions

enableDebugLogs

  • enableDebugLogs(enable?: boolean): void
  • Enable or disable logs with debug level.

    Parameters

    • Default value enable: boolean = true

      Default is true

    Returns void

makeCommand

  • makeCommand<T>(name: string, definition: T): CommandData<T>

Utils Functions

commandFullName

  • commandFullName(command: Command): string

commandRawHelp

getListRawData

Generated using TypeDoc