Options
All
  • Public
  • Public/Protected
  • All
Menu

commandbot

Index

Type aliases

APICommandType

APICommandType: "CHAT_INPUT" | "USER" | "MESSAGE"

Discord application command types CHAT_INPUT - chat interaction (prefix or slash commands) USER - context menu interaction for user MESSAGE - context menu interaction for message

BaseCommandType

BaseCommandType: "BASE" | "FUNCTION" | "GUILD" | "PERMISSION" | "PERMISSIONGUILD"

Types of command bases

BaseCommands

BaseCommands<T>: T extends "BASE" ? Command : T extends "FUNCTION" ? FunctionCommand : T extends "GUILD" ? GuildCommand : T extends "PERMISSION" ? PermissionCommand : T extends "PERMISSIONGUILD" ? PermissionGuildCommand : never

Base command type selector

Type parameters

ChatCommandOptionType

ChatCommandOptionType: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10

Acceptable CHAT_INPUT command option types (read more here)

ChildCommandInit

ChildCommandInit<T>: T extends "COMMAND" ? SubCommandInit : T extends "GROUP" ? SubCommandGroupInit : never

Child command initializer selector

Type parameters

ChildCommandResolvable

ChildCommandResolvable: SubCommandGroup | SubCommand

Child command resolvables

ChildCommandType

ChildCommandType: "COMMAND" | "GROUP"

Child command types

ChildCommands

ChildCommands<T>: T extends "COMMAND" ? SubCommand : T extends "GROUP" ? SubCommandGroup : never

Child command type selector

Type parameters

CommandFunction

CommandFunction: (input: InputManager) => CommandFunctionReturnTypes

Type declaration

    • Command function definition

      If function returns (also after resolving a Promise):

      • void - If announceSuccess property is set to true, bot will automatically send a SUCCESS message (details). If command has been called using slash commands and announceSuccess property is set to false, reply will be automatically deleted
      • string - this string will be sent in a reply
      • MessageEmbed - embedded content will be sent in a reply
      • ReplyMessageOptions - these options will get used to send a reply

      It is possible to manually send replies directly from the command function using the interaction property from InputManager argument. If you are using slash commands don't forget to use the CommandInteraction.prototype.editReply method instead of the reply method since a reply is already deferred when a command function gets called (read more here) If you try to create a new reply, you app will throw an error that will result a crash.

      If you manually reply to a slash command interaction and return void from the command function, a SUCCESS message will not be sent or reply will not get deleted (if you want to disable SUCCESS messages on prefix interactions set announceSuccess property to false).

      If command function throws an error, it will automatically get caught and your bot will send an ERROR message. The app will not crash.

      Parameters

      Returns CommandFunctionReturnTypes

CommandFunctionReturnTypes

CommandFunctionReturnTypes: void | string | MessageEmbed | ReplyMessageOptions | Promise<void | string | MessageEmbed | ReplyMessageOptions>

All types that can be returned from a command function

CommandInit

CommandInit<T>: T extends "CHAT" ? ChatCommandInit : T extends "CONTEXT" ? ContextMenuCommandInit : never

Command initializer selector

Type parameters

CommandPermissionType

CommandPermissionType: "ROLE" | "USER"

Discord permission types

CommandType

CommandType: "CHAT" | "CONTEXT"

Command types

Commands

Commands<T>: T extends "CHAT" ? ChatCommand : T extends "CONTEXT" ? ContextMenuCommand : never

Command type selector

Type parameters

ContextType

ContextType: "USER" | "MESSAGE"

Context menu command types

  • USER - right-click context menu interactions on users
  • MESSAGE - right-click context menu interactions on messages

EphemeralType

EphemeralType: "NONE" | "INTERACTIONS" | "FULL"

Ephemeral response types

  • NONE - bot replies are public and visible to everyone in a text channel
  • INTERACTIONS - bot will mark responses to Discord interactions as ephemeral and they will only be visible to the command caller
  • FULL - INTERACTIONS + responses to prefix interactions will be sent as direct messages to the command caller

Read more

InputParameterValue

InputParameterValue<T>: T extends "string" ? string : T extends "boolean" ? boolean : T extends "number" ? number : T extends "user" ? ObjectID<"user"> : T extends "role" ? ObjectID<"role"> : T extends "channel" ? ObjectID<"channel"> : T extends "mentionable" ? ObjectID<"mentionable"> : never

Input parameter value resolvable selector

Type parameters

MessageType

MessageType: "PERMISSION" | "ERROR" | "NOT_FOUND" | "SUCCESS"

Types of system messages

ObjectIdReturnType

ObjectIdReturnType<T>: T extends "channel" ? TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StageChannel | StoreChannel | null : T extends "user" ? GuildMember | null : T extends "role" ? Role | null : T extends "mentionable" ? TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StageChannel | StoreChannel | GuildMember | Role | null : never

ObjectID.prototype.toObject() return type selector

Type parameters

ObjectIdType

ObjectIdType: "user" | "role" | "channel" | "mentionable"

Types of Discord objects (IDs contained in an ObjectID wrapper)

  • user - server users list shown as selection menu in Discord
  • role - server roles list shown as selection menu in Discord
  • channel - server text, voice, stage, and category channels list shown as selection menu in Discord
  • mentionable - all objects that can be mentioned list shown as selection menu in Discord

ParameterResolvable

ParameterResolvable: string | boolean | number | ObjectID<any> | TargetID<any> | null

All parameter resolvables

ParameterType

ParameterType: "string" | "boolean" | "number" | ObjectIdType

Parameter type values

  • string - text value
  • boolean - True or False
  • number - number (double) value

PermissionCheckTypes

PermissionCheckTypes: "ALL" | "ANY"

Permission checking methods

ALL - uses Permissions.prototype.has method

ANY - uses Permissions.prototype.any method

PermissionFunction

PermissionFunction: (i: Interaction | Message) => boolean

Type declaration

    • (i: Interaction | Message): boolean
    • Definition of permission function

      Parameters

      • i: Interaction | Message

      Returns boolean

ScopeResolvable

ScopeResolvable: string | Guild

Prefix scope types

TargetIdReturnType

TargetIdReturnType<T>: T extends "USER" ? GuildMember : T extends "MESSAGE" ? Message : never

TargetID.prototype.toObject() return type selector

Type parameters

TargetType

TargetType: "MESSAGE" | "USER"

Types of Discord context menu targets (IDs contained in a TargetID wrapper)

Generated using TypeDoc