From 948165802dcaa0bc141ed21e224cb469d0e681b0 Mon Sep 17 00:00:00 2001 From: GRZ4NA Date: Mon, 22 Nov 2021 19:13:04 +0100 Subject: [PATCH] Experimental features docs --- README.md | 6 ++ docs/classes/Bot.html | 24 ++++---- docs/classes/ChatCommand.html | 54 +++++++++--------- docs/classes/Command.html | 18 +++--- docs/classes/CommandManager.html | 56 ++++++++++--------- docs/classes/CommandPermissions.html | 14 ++--- docs/classes/ContextMenuCommand.html | 30 +++++----- docs/classes/FunctionCommand.html | 26 ++++----- docs/classes/GuildCommand.html | 26 ++++----- docs/classes/HelpMessage.html | 56 +++++++++---------- docs/classes/InputManager.html | 12 ++-- docs/classes/MissingParameterError.html | 6 +- docs/classes/OperationSuccess.html | 4 +- docs/classes/ParameterTypeError.html | 8 +-- docs/classes/PermissionCommand.html | 24 ++++---- docs/classes/PermissionGuildCommand.html | 28 +++++----- docs/classes/PermissionsError.html | 8 +-- docs/classes/PrefixManager.html | 19 ++++--- docs/classes/SubCommand.html | 32 +++++------ docs/classes/SubCommandGroup.html | 28 +++++----- docs/classes/SystemMessageManager.html | 14 ++--- docs/index.html | 9 +++ docs/interfaces/APICommandInit.html | 4 +- docs/interfaces/APICommandObject.html | 4 +- docs/interfaces/ChatCommandInit.html | 26 ++++----- docs/interfaces/ChatCommandObject.html | 10 ++-- docs/interfaces/ChatCommandOptionObject.html | 12 ++-- docs/interfaces/CommandPermission.html | 2 +- docs/interfaces/CommandPermissionsInit.html | 4 +- docs/interfaces/ContextMenuCommandInit.html | 16 +++--- docs/interfaces/ContextMenuCommandObject.html | 6 +- docs/interfaces/FunctionCommandInit.html | 8 +-- docs/interfaces/GuildCommandInit.html | 12 ++-- docs/interfaces/HelpMessageParams.html | 14 ++--- docs/interfaces/InitOptions.html | 16 +++--- docs/interfaces/ParameterSchema.html | 10 ++-- docs/interfaces/PermissionCommandInit.html | 10 ++-- .../PermissionGuildCommandInit.html | 14 ++--- docs/interfaces/RegisteredCommandObject.html | 2 +- docs/interfaces/SubCommandGroupInit.html | 6 +- docs/interfaces/SubCommandGroupObject.html | 6 +- docs/interfaces/SubCommandInit.html | 16 +++--- docs/interfaces/SystemMessageAppearance.html | 16 +++--- docs/interfaces/SystemMessageData.html | 8 +-- .../TextCommandOptionChoiceObject.html | 2 +- docs/modules.html | 52 ++++++++--------- src/commands/ChatCommand.ts | 2 +- src/structures/CommandManager.ts | 2 + src/structures/PrefixManager.ts | 5 ++ 49 files changed, 407 insertions(+), 380 deletions(-) diff --git a/README.md b/README.md index ad73e4a..53d59b4 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ Reference for available objects and structures is available [**here**](https://g - [Messages](#messages) - [System messages](#system-messages) - [Help message](#help-message) +- [Experimental features](#experimental-features) - [Issues](#issues) # Installation @@ -258,6 +259,11 @@ To configure it use the _[help](https://grz4na.github.io/CommandBot/interfaces/I > **WARNING!** You can't customize these messages after starting the bot. Changing these properties while the bot is running will have no effect. +# Experimental features + +- The package has a _[PrefixManager](https://grz4na.github.io/CommandBot/classes/PrefixManager.html)_ class which is taking care of setting different prefixes for every server that the bot is on but there is no module to store that date in a file or database so the it's lost every time the application restarts. If you want to use it in your project, you should create a data store and write a function that dumps the data there. +- _[CommandManager](https://grz4na.github.io/CommandBot/classes/CommandManager.html)_ has 2 methods to interact with the Discord Permissions API (_getPermissionsApi_ and _setPermissionsApi_) and set interaction permissions that are independent from the CommandBot permission system. This functionality has not been polished and fully tested yet. + # Issues Since this package is created by only 1 person it may contain some bugs or behave weirdly. If you notice any problem, typo etc, please create an issue in the _[Issues](https://github.com/GRZ4NA/CommandBot/issues)_ tab on GitHub. diff --git a/docs/classes/Bot.html b/docs/classes/Bot.html index 4afb4d2..030f2c2 100644 --- a/docs/classes/Bot.html +++ b/docs/classes/Bot.html @@ -1,26 +1,26 @@ Bot | commandbot
Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Bot

Application instance

-

Hierarchy

  • EventEmitter
    • Bot

Index

Constructors

constructor

Hierarchy

  • EventEmitter
    • Bot

Index

Constructors

constructor

Events

on

  • on(event: "READY", listener: Function): Bot
  • on(event: "MESSAGE", listener: (m: Message) => void): Bot
  • on(event: "COMMAND", listener: (m: Message | CommandInteraction, cmdMsg: InputManager) => void): Bot
  • on(event: "ERROR", listener: (e: any) => void): Bot

Events

on

  • on(event: "READY", listener: Function): Bot
  • on(event: "MESSAGE", listener: (m: Message) => void): Bot
  • on(event: "COMMAND", listener: (m: Message | CommandInteraction, cmdMsg: InputManager) => void): Bot
  • on(event: "ERROR", listener: (e: any) => void): Bot
  • Emitted after connecting to Discord API

    -

    Parameters

    • event: "READY"
    • listener: Function

    Returns Bot

  • +

    Parameters

    • event: "READY"
    • listener: Function

    Returns Bot

  • Emitted whenever bot receives a Discord message

    -

    Parameters

    • event: "MESSAGE"
    • listener: (m: Message) => void
        • (m: Message): void
        • Parameters

          • m: Message

          Returns void

    Returns Bot

  • +

    Parameters

    • event: "MESSAGE"
    • listener: (m: Message) => void
        • (m: Message): void
        • Parameters

          • m: Message

          Returns void

    Returns Bot

  • Emitted whenever bots receives a Discord message or interaction that gets recognized as a CommandBot command

    -

    Parameters

    • event: "COMMAND"
    • listener: (m: Message | CommandInteraction, cmdMsg: InputManager) => void
        • (m: Message | CommandInteraction, cmdMsg: InputManager): void
        • Parameters

          Returns void

    Returns Bot

  • +

    Parameters

    • event: "COMMAND"
    • listener: (m: Message | CommandInteraction, cmdMsg: InputManager) => void
        • (m: Message | CommandInteraction, cmdMsg: InputManager): void
        • Parameters

          Returns void

    Returns Bot

  • Emitted on every bot error

    -

    Parameters

    • event: "ERROR"
    • listener: (e: any) => void
        • (e: any): void
        • Parameters

          • e: any

          Returns void

    Returns Bot

Properties

Readonly applicationId

applicationId: string
+

Parameters

  • event: "ERROR"
  • listener: (e: any) => void
      • (e: any): void
      • Parameters

        • e: any

        Returns void

Returns Bot

Properties

Readonly applicationId

applicationId: string

Discord API application ID

-
readonly

Readonly client

client: Client<boolean>
+
readonly

Readonly client

client: Client<boolean>

Discord.js {@link Client} instance

-
readonly

Readonly commands

commands: CommandManager
+
readonly

Readonly commands

commands: CommandManager

Instance command manager

-
readonly

Readonly messages

+
readonly

Readonly messages

SystemMessageManager storing messages' configuration

-
readonly

Readonly name

name: string
+
readonly

Readonly name

name: string

Bot name

-
readonly

Readonly token

token: string
+
readonly

Readonly token

token: string

Discord Bot token

readonly

Static Readonly captureRejectionSymbol

captureRejectionSymbol: typeof captureRejectionSymbol

Static captureRejections

captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

@@ -31,7 +31,7 @@ events. Listeners installed using this symbol are called before the regular

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

-

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): Bot
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Bot

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount(event: string | symbol): number
  • Parameters

    • event: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): Bot
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Bot

once

  • once(event: string | symbol, listener: (...args: any[]) => void): Bot
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Bot

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): Bot
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Bot

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): Bot
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Bot

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): Bot
  • Parameters

    • Optional event: string | symbol

    Returns Bot

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): Bot
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Bot

setMaxListeners

  • setMaxListeners(n: number): Bot
  • Parameters

    • n: number

    Returns Bot

start

  • start(port?: number, register?: boolean): Promise<boolean>

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): Bot
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Bot

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount(event: string | symbol): number
  • Parameters

    • event: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): Bot
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Bot

once

  • once(event: string | symbol, listener: (...args: any[]) => void): Bot
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Bot

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): Bot
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Bot

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): Bot
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Bot

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): Bot
  • Parameters

    • Optional event: string | symbol

    Returns Bot

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): Bot
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Bot

setMaxListeners

  • setMaxListeners(n: number): Bot
  • Parameters

    • n: number

    Returns Bot

start

  • start(port?: number, register?: boolean): Promise<boolean>
  • Starts your Discord bot

    async

    Parameters

    • Optional port: number
    • Optional register: boolean

    Returns Promise<boolean>

    whether this operation has been completed successfully

Static getEventListener

  • getEventListener(emitter: DOMEventTarget | EventEmitter, name: string | symbol): Function[]

Returns ChatCommand

Properties

Private Readonly _children

_children: ChildCommandResolvable[] = []

Subcommands and groups of this command

-
readonly

Optional Readonly aliases

aliases?: string[]
+
readonly

Optional Readonly aliases

aliases?: string[]

List of different names that can be used to invoke a command (when using prefix interactions)

-
readonly

Readonly announceSuccess

announceSuccess: boolean
+
readonly

Readonly announceSuccess

announceSuccess: boolean

Whether a SUCCESS message should be sent after executing the command function (when there is no other reply)

-
readonly

Readonly default_permission

default_permission: boolean
+
readonly

Readonly default_permission

default_permission: boolean

Discord API default_permission

-
readonly

Readonly description

description: string
+
readonly

Readonly description

description: string

Command description displayed in the help message or in slash commands menu (Default description: "No description")

-
readonly

Readonly dm

dm: boolean
+
readonly

Readonly dm

dm: boolean

If set to false, all interactions that get invoked from private/direct conversations (outside a guild) will result a PermissionError

-
readonly

Optional Readonly guilds

guilds?: string[]
+
readonly

Optional Readonly guilds

guilds?: string[]

List of Discord guild (server) IDs in which this command can be used

-
readonly

Readonly manager

+
readonly

Readonly manager

Manager in which this command is registered

-
readonly

Readonly name

name: string
+
readonly

Readonly name

name: string

Command name

-
readonly

Readonly parameters

parameters: Parameter<any>[]
+
readonly

Readonly parameters

parameters: Parameter<any>[]

List of parameters that can passed to this command

-
readonly

Readonly permissions

permissions: CommandPermissions
+
readonly

Readonly permissions

permissions: CommandPermissions

Object containing check functions and permission bitfields

-
readonly

Readonly slash

slash: boolean
+
readonly

Readonly slash

slash: boolean

Whether this command should be registered as a slash command (default: true)

-
readonly

Readonly type

+
readonly

Readonly type

CommandBot's internal command type

-
readonly

Optional Readonly usage

usage?: string
+
readonly

Optional Readonly usage

usage?: string

Command usage displayed in the help message

-
readonly

Readonly visible

visible: boolean
+
readonly

Readonly visible

visible: boolean

Whether this command is visible in the help message (default: true)

-
readonly

Accessors

children

Accessors

children

hasSubCommands

  • get hasSubCommands(): boolean

hasSubCommands

  • get hasSubCommands(): boolean

Methods

append

  • -

    Attaches subcommand or subcommand group to this ChatCommand (this makes the base command usable only via prefix interactions)

    +

    Returns boolean

Methods

append

  • +

    Attaches subcommand or subcommand group to this ChatCommand

    remarks

    After appending a subcommand or a subcommand group the main command can only be invoked using prefix interactions

    Type parameters

    Parameters

    Returns ChildCommands<T>

    A computed subcommand object

    -

fetchSubcommand

  • fetchSubcommand(options: CommandInteractionOption[], interaction: Message | Interaction): null | InputManager

fetchSubcommand

  • fetchSubcommand(options: CommandInteractionOption[], interaction: Message | Interaction): null | InputManager

getSubcommand

  • getSubcommand(name: string, group?: string): null | SubCommand

getSubcommand

  • getSubcommand(name: string, group?: string): null | SubCommand

isBaseCommandType

isBaseCommandType

isChildCommandType

isChildCommandType

isCommandType

  • isCommandType<T>(type: T): this is Commands<T>

isCommandType

  • isCommandType<T>(type: T): this is Commands<T>

start

start

toObject

Returns Promise<void>

toObject

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/Command.html b/docs/classes/Command.html index 39d7ed3..087b365 100644 --- a/docs/classes/Command.html +++ b/docs/classes/Command.html @@ -1,6 +1,6 @@ Command | commandbot
Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Command

Bot core command object

-

Hierarchy

Index

Constructors

constructor

Hierarchy

Index

Constructors

constructor

Properties

Readonly default_permission

default_permission: boolean
+

Returns Command

Properties

Readonly default_permission

default_permission: boolean

Discord API default_permission

-
readonly

Readonly manager

+
readonly

Readonly manager

Manager in which this command is registered

-
readonly

Readonly name

name: string
+
readonly

Readonly name

name: string

Command name

-
readonly

Readonly type

+
readonly

Readonly type

CommandBot's internal command type

-
readonly

Methods

isBaseCommandType

Methods

isBaseCommandType

isChildCommandType

isChildCommandType

isCommandType

  • isCommandType<T>(type: T): this is Commands<T>

isCommandType

  • isCommandType<T>(type: T): this is Commands<T>

toObject

toObject

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/CommandManager.html b/docs/classes/CommandManager.html index 0e133f9..352c48d 100644 --- a/docs/classes/CommandManager.html +++ b/docs/classes/CommandManager.html @@ -1,30 +1,30 @@ CommandManager | commandbot
Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CommandManager

Object that stores the registered commands and is responsible for data exchanging with the Discord API

-

Hierarchy

  • CommandManager

Index

Constructors

constructor

Hierarchy

  • CommandManager

Index

Constructors

constructor

Properties

Private Readonly _commands

_commands: Command[] = []
+
  • Optional prefix: string
  • Optional argSep: string
  • Optional cmdSep: string
  • Returns CommandManager

    Properties

    Private Readonly _commands

    _commands: Command[] = []

    List of commands registered in the manager

    -
    readonly

    Private Readonly _globalEntryName

    _globalEntryName: string = "global"

    Private Readonly _registerCache

    _registerCache: Map<string, Map<string, RegisteredCommandObject>> = ...
    +
    readonly

    Private Readonly _globalEntryName

    _globalEntryName: string = "global"

    Private Readonly _registerCache

    _registerCache: Map<string, Map<string, RegisteredCommandObject>> = ...

    Cache of Discord API commands data

    -
    readonly

    Readonly argumentSeparator

    argumentSeparator: string
    +
    readonly

    Readonly argumentSeparator

    argumentSeparator: string

    A string used to split all incoming input data from Discord messages

    -
    readonly

    Readonly client

    client: Bot
    +
    readonly

    Readonly client

    client: Bot

    Client connected to this manager

    -
    readonly

    Readonly commandSeparator

    commandSeparator: string
    +
    readonly

    Readonly commandSeparator

    commandSeparator: string

    A string used to separate subcommand groups and subcommands

    -
    readonly

    Optional Readonly help

    +
    readonly

    Optional Readonly help

    Help command associated with this manager

    -
    readonly

    Readonly prefix

    +
    readonly

    Readonly prefix

    A manager holding all guild-specific prefixes and a global prefix

    -
    readonly

    Static Readonly baseApiUrl

    baseApiUrl: string = "https://discord.com/api/v8"
    +
    readonly

    Static Readonly baseApiUrl

    baseApiUrl: string = "https://discord.com/api/v8"

    Discord API URL

    -
    static
    readonly

    Accessors

    cache

    Accessors

    cache

    commandsCount

    • get commandsCount(): number

    commandsCount

    • get commandsCount(): number

    Methods

    add

    Methods

    add

    • Creates and registers command in the manager based on the given options

      remarks

      All commands have to be added to the instance before starting the bot. Adding commands while the bot is running is not possible and can cause issues.

      Command types

      @@ -38,55 +38,57 @@
  • options: CommandInit<T>

    an object containing all properties required to create this type of command

  • Returns Commands<T>

    A computed command object that inherits from Command

    -

    Private arrayToMap

    Private arrayToMap

    fetch

    fetch

    • Process an interaction

      Parameters

      • i: Message | Interaction

        interaction object to fetch a command from

      Returns null | InputManager

      An InputManager containing all input data (command, arguments, target etc.)

      -

    get

    • get<T>(q: string, t?: T): null | Commands<T>

    get

    • get<T>(q: string, t?: T): null | Commands<T>

    getApi

    getApi

    Private getCache

    Private getCache

    getIdApi

    • getIdApi(name: string, type: APICommandType, guild?: string | Guild): Promise<null | string>

    getIdApi

    • getIdApi(name: string, type: APICommandType, guild?: string | Guild): Promise<null | string>
    • Fetches command ID by name from the Discord APi

      async

      Parameters

      • name: string

        name of the command

      • type: APICommandType

        command type you want to get ID for

      • Optional guild: string | Guild

      Returns Promise<null | string>

      Command ID from the Discord API

      -

    getPermissionsApi

    getPermissionsApi

    • Get permissions from Discord Permissions API for a specified command

      -
      async

      Parameters

      • id: string
        +
        async
        experimental

        This functionality hasn't been polished and fully tested yet. Using it might lead to errors and application crashes.

        +

        Parameters

        • id: string

          command ID

          -
        • Optional g: string | Guild

        Returns Promise<CommandPermission[]>

    list

    Returns Promise<CommandPermission[]>

    list

    listApi

    listApi

    register

    • register(): Promise<void>

    register

    • register(): Promise<void>

    setPermissionsApi

    • setPermissionsApi(id: string, permissions: CommandPermission[], g?: string | Guild): Promise<void>

    setPermissionsApi

    • setPermissionsApi(id: string, permissions: CommandPermission[], g?: string | Guild): Promise<void>
    • Set permissions using Discord Permissions API

      -
      async

      Parameters

      • id: string
        +
        async
        experimental

        This functionality hasn't been polished and fully tested yet. Using it might lead to errors and application crashes.

        +

        Parameters

        • id: string

          command ID

        • permissions: CommandPermission[]

          permissions to set

          -
        • Optional g: string | Guild

        Returns Promise<void>

    Private updateCache

    Private updateCache

    Static isCommand

    Static isCommand

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/CommandPermissions.html b/docs/classes/CommandPermissions.html index 5eef4ed..84c3e14 100644 --- a/docs/classes/CommandPermissions.html +++ b/docs/classes/CommandPermissions.html @@ -1,18 +1,18 @@ CommandPermissions | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Class CommandPermissions

    Object that stores permission resolvables and properties (bouund to a PermissionCommand)

    -

    Hierarchy

    • CommandPermissions

    Index

    Constructors

    constructor

    Hierarchy

    • CommandPermissions

    Index

    Constructors

    constructor

    Properties

    Readonly checkType

    +
  • Optional o: CommandPermissionsInit
  • Returns CommandPermissions

    Properties

    Readonly checkType

    Command permissions

    -
    readonly

    Readonly command

    +
    readonly

    Readonly command

    Command bound to this object

    -
    readonly

    Readonly permissions

    permissions: PermissionFunction | Permissions
    +
    readonly

    Readonly permissions

    permissions: PermissionFunction | Permissions

    If set to "ALL", the command can only be used when all specified conditions are met. (works only for Discord.js permissions object)

    -
    readonly

    Accessors

    bitfield

    • get bitfield(): BigInt

    Accessors

    bitfield

    • get bitfield(): BigInt

    isCustom

    • get isCustom(): boolean

    isCustom

    • get isCustom(): boolean

    Methods

    check

    • check(i: Message | Interaction): boolean

    Methods

    check

    • check(i: Message | Interaction): boolean

    Properties

    Readonly announceSuccess

    announceSuccess: boolean

    Whether a SUCCESS message should be sent after executing the command function (when there is no other reply)

    -
    readonly

    Readonly contextType

    contextType: ContextType
    +
    readonly

    Readonly contextType

    contextType: ContextType

    Type of context menu interaction

    -
    readonly

    Readonly default_permission

    default_permission: boolean
    +
    readonly

    Readonly default_permission

    default_permission: boolean

    Discord API default_permission

    -
    readonly

    Readonly dm

    dm: boolean
    +
    readonly

    Readonly dm

    dm: boolean

    If set to false, all interactions that get invoked from private/direct conversations (outside a guild) will result a PermissionError

    -
    readonly

    Optional Readonly guilds

    guilds?: string[]
    +
    readonly

    Optional Readonly guilds

    guilds?: string[]

    List of Discord guild (server) IDs in which this command can be used

    -
    readonly

    Readonly manager

    +
    readonly

    Readonly manager

    Manager in which this command is registered

    -
    readonly

    Readonly name

    name: string
    +
    readonly

    Readonly name

    name: string

    Command name

    -
    readonly

    Readonly permissions

    permissions: CommandPermissions
    +
    readonly

    Readonly permissions

    permissions: CommandPermissions

    Object containing check functions and permission bitfields

    -
    readonly

    Readonly type

    +
    readonly

    Readonly type

    CommandBot's internal command type

    -
    readonly

    Methods

    isBaseCommandType

    Methods

    isBaseCommandType

    isChildCommandType

    isChildCommandType

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    start

    start

    toObject

    Returns Promise<void>

    toObject

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/FunctionCommand.html b/docs/classes/FunctionCommand.html index 9b57e05..667dbe9 100644 --- a/docs/classes/FunctionCommand.html +++ b/docs/classes/FunctionCommand.html @@ -1,6 +1,6 @@ FunctionCommand | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Class FunctionCommand

    Function (executable) command

    -

    Hierarchy

    Index

    Constructors

    constructor

    Hierarchy

    Index

    Constructors

    constructor

    Properties

    Private Readonly _function

    _function: CommandFunction
    +

    Returns FunctionCommand

    Properties

    Private Readonly _function

    _function: CommandFunction

    Command function (called on command execution)

    -
    readonly

    Readonly announceSuccess

    announceSuccess: boolean
    +
    readonly

    Readonly announceSuccess

    announceSuccess: boolean

    Whether a SUCCESS message should be sent after executing the command function (when there is no other reply)

    -
    readonly

    Readonly default_permission

    default_permission: boolean
    +
    readonly

    Readonly default_permission

    default_permission: boolean

    Discord API default_permission

    -
    readonly

    Readonly manager

    +
    readonly

    Readonly manager

    Manager in which this command is registered

    -
    readonly

    Readonly name

    name: string
    +
    readonly

    Readonly name

    name: string

    Command name

    -
    readonly

    Readonly type

    +
    readonly

    Readonly type

    CommandBot's internal command type

    -
    readonly

    Methods

    Private handleReply

    • handleReply(interaction: Message | Interaction, result: string | void | MessageEmbed | ReplyMessageOptions): Promise<void>

    Methods

    Private handleReply

    • handleReply(interaction: Message | Interaction, result: string | void | MessageEmbed | ReplyMessageOptions): Promise<void>
    • Reply handler

      async

      Parameters

      • interaction: Message | Interaction

        Discord interaction object

      • result: string | void | MessageEmbed | ReplyMessageOptions

        result of command function execution

        -

      Returns Promise<void>

    isBaseCommandType

    Returns Promise<void>

    isBaseCommandType

    isChildCommandType

    isChildCommandType

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    start

    start

    toObject

    toObject

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/GuildCommand.html b/docs/classes/GuildCommand.html index d9348e4..33ac95e 100644 --- a/docs/classes/GuildCommand.html +++ b/docs/classes/GuildCommand.html @@ -1,6 +1,6 @@ GuildCommand | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Class GuildCommand

    Guild-scoped executable command

    -

    Hierarchy

    Implemented by

    Index

    Constructors

    constructor

    Hierarchy

    Implemented by

    Index

    Constructors

    constructor

    Properties

    Readonly announceSuccess

    announceSuccess: boolean
    +

    Returns GuildCommand

    Properties

    Readonly announceSuccess

    announceSuccess: boolean

    Whether a SUCCESS message should be sent after executing the command function (when there is no other reply)

    -
    readonly

    Readonly default_permission

    default_permission: boolean
    +
    readonly

    Readonly default_permission

    default_permission: boolean

    Discord API default_permission

    -
    readonly

    Readonly dm

    dm: boolean
    +
    readonly

    Readonly dm

    dm: boolean

    If set to false, all interactions that get invoked from private/direct conversations (outside a guild) will result a PermissionError

    -
    readonly

    Optional Readonly guilds

    guilds?: string[]
    +
    readonly

    Optional Readonly guilds

    guilds?: string[]

    List of Discord guild (server) IDs in which this command can be used

    -
    readonly

    Readonly manager

    +
    readonly

    Readonly manager

    Manager in which this command is registered

    -
    readonly

    Readonly name

    name: string
    +
    readonly

    Readonly name

    name: string

    Command name

    -
    readonly

    Readonly type

    +
    readonly

    Readonly type

    CommandBot's internal command type

    -
    readonly

    Methods

    isBaseCommandType

    Methods

    isBaseCommandType

    isChildCommandType

    isChildCommandType

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    start

    start

    toObject

    Returns Promise<void>

    toObject

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/HelpMessage.html b/docs/classes/HelpMessage.html index ad808c8..1d83529 100644 --- a/docs/classes/HelpMessage.html +++ b/docs/classes/HelpMessage.html @@ -1,82 +1,82 @@ -HelpMessage | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Class HelpMessage

    Hierarchy

    Index

    Constructors

    constructor

    Returns HelpMessage

    Properties

    Private Readonly _appearance

    _appearance: HelpMessageParams

    Help message appearance options

    -
    readonly

    Optional Readonly aliases

    aliases?: string[]
    +
    readonly

    Optional Readonly aliases

    aliases?: string[]

    List of different names that can be used to invoke a command (when using prefix interactions)

    -
    readonly

    Readonly announceSuccess

    announceSuccess: boolean
    +
    readonly

    Readonly announceSuccess

    announceSuccess: boolean

    Whether a SUCCESS message should be sent after executing the command function (when there is no other reply)

    -
    readonly

    Readonly default_permission

    default_permission: boolean
    +
    readonly

    Readonly default_permission

    default_permission: boolean

    Discord API default_permission

    -
    readonly

    Readonly description

    description: string
    +
    readonly

    Readonly description

    description: string

    Command description displayed in the help message or in slash commands menu (Default description: "No description")

    -
    readonly

    Readonly dm

    dm: boolean
    +
    readonly

    Readonly dm

    dm: boolean

    If set to false, all interactions that get invoked from private/direct conversations (outside a guild) will result a PermissionError

    -
    readonly

    Optional Readonly guilds

    guilds?: string[]
    +
    readonly

    Optional Readonly guilds

    guilds?: string[]

    List of Discord guild (server) IDs in which this command can be used

    -
    readonly

    Readonly manager

    +
    readonly

    Readonly manager

    Manager in which this command is registered

    -
    readonly

    Readonly name

    name: string
    +
    readonly

    Readonly name

    name: string

    Command name

    -
    readonly

    Readonly parameters

    parameters: Parameter<any>[]
    +
    readonly

    Readonly parameters

    parameters: Parameter<any>[]

    List of parameters that can passed to this command

    -
    readonly

    Readonly permissions

    permissions: CommandPermissions
    +
    readonly

    Readonly permissions

    permissions: CommandPermissions

    Object containing check functions and permission bitfields

    -
    readonly

    Readonly slash

    slash: boolean
    +
    readonly

    Readonly slash

    slash: boolean

    Whether this command should be registered as a slash command (default: true)

    -
    readonly

    Readonly type

    +
    readonly

    Readonly type

    CommandBot's internal command type

    -
    readonly

    Optional Readonly usage

    usage?: string
    +
    readonly

    Optional Readonly usage

    usage?: string

    Command usage displayed in the help message

    -
    readonly

    Readonly visible

    visible: boolean
    +
    readonly

    Readonly visible

    visible: boolean

    Whether this command is visible in the help message (default: true)

    -
    readonly

    Accessors

    children

    Accessors

    children

    hasSubCommands

    • get hasSubCommands(): boolean

    hasSubCommands

    • get hasSubCommands(): boolean

    Methods

    append

    Methods

    append

    fetchSubcommand

    • fetchSubcommand(options: CommandInteractionOption[], interaction: Message | Interaction): null | InputManager

    fetchSubcommand

    • fetchSubcommand(options: CommandInteractionOption[], interaction: Message | Interaction): null | InputManager

    generateMessage

    • generateMessage(i: Message | Interaction, cmdName?: string): MessageEmbed

    generateMessage

    • generateMessage(i: Message | Interaction, cmdName?: string): MessageEmbed
    • Parameters

      • i: Message | Interaction

        Discord interaction

      • Optional cmdName: string

      Returns MessageEmbed

      A computed help message in form of {@link MessageEmbed}

      -

    getSubcommand

    • getSubcommand(name: string, group?: string): null | SubCommand

    getSubcommand

    • getSubcommand(name: string, group?: string): null | SubCommand

    isBaseCommandType

    isBaseCommandType

    isChildCommandType

    isChildCommandType

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    start

    start

    toObject

    Returns Promise<void>

    toObject

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/InputManager.html b/docs/classes/InputManager.html index e80cb2c..531a176 100644 --- a/docs/classes/InputManager.html +++ b/docs/classes/InputManager.html @@ -1,20 +1,20 @@ InputManager | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Class InputManager

    Object that stores all interaction input data (target, arguments, content and the interaction itself)

    -

    Hierarchy

    • InputManager

    Index

    Constructors

    constructor

    Hierarchy

    • InputManager

    Index

    Constructors

    constructor

    Properties

    Private Readonly arguments

    arguments: InputParameter<any>[]
    +
  • Optional target: TargetID<any>
  • Returns InputManager

    Properties

    Private Readonly arguments

    arguments: InputParameter<any>[]

    All input arguments

    -
    readonly

    Readonly command

    +
    readonly

    Readonly command

    Command related to this manager

    -
    readonly

    Readonly interaction

    interaction: Message | Interaction
    +
    readonly

    Readonly interaction

    interaction: Message | Interaction

    Command interaction or message

    -
    readonly

    Optional Readonly target

    target?: TargetID<any>
    +
    readonly

    Optional Readonly target

    target?: TargetID<any>

    Command target (when using context menu interactions)

    -
    readonly

    Methods

    get

    Methods

    get

    Properties

    Private Readonly argument

    argument: Parameter<any>

    Missing parameter object

    -
    readonly

    message

    message: string

    name

    name: string

    Optional stack

    stack?: string

    Static stackTraceLimit

    stackTraceLimit: number

    Methods

    toString

    • toString(): string

    message

    message: string

    name

    name: string

    Optional stack

    stack?: string

    Static stackTraceLimit

    stackTraceLimit: number

    Methods

    toString

    • toString(): string
    • Converts error object to user-readable message

      Returns string

      Formatted error message

    Static captureStackTrace

    • captureStackTrace(targetObject: object, constructorOpt?: Function): void

    Returns OperationSuccess

    Properties

    Readonly command

    command: Command

    Command that succeeded

    readonly

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/ParameterTypeError.html b/docs/classes/ParameterTypeError.html index a0580eb..7f7e1e4 100644 --- a/docs/classes/ParameterTypeError.html +++ b/docs/classes/ParameterTypeError.html @@ -1,14 +1,14 @@ ParameterTypeError | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Class ParameterTypeError

    Error indicating that an input value cannot be converted to a expected type

    -

    Hierarchy

    • TypeError
      • ParameterTypeError

    Index

    Constructors

    constructor

    Hierarchy

    • TypeError
      • ParameterTypeError

    Index

    Constructors

    constructor

    Properties

    message

    message: string

    name

    name: string

    Optional stack

    stack?: string

    Private Readonly stringContent

    stringContent: string
    +

    Returns ParameterTypeError

    Properties

    message

    message: string

    name

    name: string

    Optional stack

    stack?: string

    Private Readonly stringContent

    stringContent: string

    Value converted to a string

    -
    readonly

    Private Readonly type

    +
    readonly

    Private Readonly type

    Expected type

    -
    readonly

    Static stackTraceLimit

    stackTraceLimit: number

    Methods

    toString

    • toString(): string

    Static stackTraceLimit

    stackTraceLimit: number

    Methods

    toString

    • toString(): string
    • Converts error object to user-readable message

      Returns string

      Formatted error message

    Static captureStackTrace

    • captureStackTrace(targetObject: object, constructorOpt?: Function): void

    Returns PermissionCommand

    Properties

    Readonly announceSuccess

    announceSuccess: boolean

    Whether a SUCCESS message should be sent after executing the command function (when there is no other reply)

    -
    readonly

    Readonly default_permission

    default_permission: boolean
    +
    readonly

    Readonly default_permission

    default_permission: boolean

    Discord API default_permission

    -
    readonly

    Readonly manager

    +
    readonly

    Readonly manager

    Manager in which this command is registered

    -
    readonly

    Readonly name

    name: string
    +
    readonly

    Readonly name

    name: string

    Command name

    -
    readonly

    Readonly permissions

    permissions: CommandPermissions
    +
    readonly

    Readonly permissions

    permissions: CommandPermissions

    Object containing check functions and permission bitfields

    -
    readonly

    Readonly type

    +
    readonly

    Readonly type

    CommandBot's internal command type

    -
    readonly

    Methods

    isBaseCommandType

    Methods

    isBaseCommandType

    isChildCommandType

    isChildCommandType

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    start

    start

    toObject

    Returns Promise<void>

    toObject

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/PermissionGuildCommand.html b/docs/classes/PermissionGuildCommand.html index 9eea03c..34b011b 100644 --- a/docs/classes/PermissionGuildCommand.html +++ b/docs/classes/PermissionGuildCommand.html @@ -1,7 +1,7 @@ PermissionGuildCommand | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Class PermissionGuildCommand

    Guild-scoped executable command with permissions attached

    implements

    {GuildCommand}

    -

    Hierarchy

    Implements

    Index

    Constructors

    constructor

    Hierarchy

    Implements

    Index

    Constructors

    constructor

    Properties

    Readonly announceSuccess

    announceSuccess: boolean
    +

    Returns PermissionGuildCommand

    Properties

    Readonly announceSuccess

    announceSuccess: boolean

    Whether a SUCCESS message should be sent after executing the command function (when there is no other reply)

    -
    readonly

    Readonly default_permission

    default_permission: boolean
    +
    readonly

    Readonly default_permission

    default_permission: boolean

    Discord API default_permission

    -
    readonly

    Readonly dm

    dm: boolean
    +
    readonly

    Readonly dm

    dm: boolean

    If set to false, all interactions that get invoked from private/direct conversations (outside a guild) will result a PermissionError

    -
    readonly

    Optional Readonly guilds

    guilds?: string[]
    +
    readonly

    Optional Readonly guilds

    guilds?: string[]

    List of Discord guild (server) IDs in which this command can be used

    -
    readonly

    Readonly manager

    +
    readonly

    Readonly manager

    Manager in which this command is registered

    -
    readonly

    Readonly name

    name: string
    +
    readonly

    Readonly name

    name: string

    Command name

    -
    readonly

    Readonly permissions

    permissions: CommandPermissions
    +
    readonly

    Readonly permissions

    permissions: CommandPermissions

    Object containing check functions and permission bitfields

    -
    readonly

    Readonly type

    +
    readonly

    Readonly type

    CommandBot's internal command type

    -
    readonly

    Methods

    isBaseCommandType

    Methods

    isBaseCommandType

    isChildCommandType

    isChildCommandType

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    start

    start

    toObject

    Returns Promise<void>

    toObject

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/PermissionsError.html b/docs/classes/PermissionsError.html index 4b380c0..4c0d5d7 100644 --- a/docs/classes/PermissionsError.html +++ b/docs/classes/PermissionsError.html @@ -1,12 +1,12 @@ PermissionsError | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Class PermissionsError

    Error indicating that a caller doesn't have enough permissions to execute a command

    -

    Hierarchy

    • Error
      • PermissionsError

    Index

    Constructors

    constructor

    Hierarchy

    • Error
      • PermissionsError

    Index

    Constructors

    constructor

    Properties

    Private Readonly command

    command: Command
    +
  • Optional user: null | GuildMember
  • Returns PermissionsError

    Properties

    Private Readonly command

    command: Command

    Command that user wanted and failed to invoke

    -
    readonly

    message

    message: string

    name

    name: string

    Optional stack

    stack?: string

    Private Readonly user

    user: null | GuildMember
    +
    readonly

    message

    message: string

    name

    name: string

    Optional stack

    stack?: string

    Private Readonly user

    user: null | GuildMember

    User that doesn't have the permissions

    -
    readonly

    Static stackTraceLimit

    stackTraceLimit: number

    Methods

    toString

    • toString(): string

    Static stackTraceLimit

    stackTraceLimit: number

    Methods

    toString

    • toString(): string
    • Converts error object to user-readable message

      Returns string

      Formatted error message

    Static captureStackTrace

    • captureStackTrace(targetObject: object, constructorOpt?: Function): void

    Returns Promise<void>

    toObject

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/SubCommandGroup.html b/docs/classes/SubCommandGroup.html index f25f610..058bf61 100644 --- a/docs/classes/SubCommandGroup.html +++ b/docs/classes/SubCommandGroup.html @@ -1,44 +1,44 @@ SubCommandGroup | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Class SubCommandGroup

    Group of subcommands

    -

    Hierarchy

    Index

    Constructors

    constructor

    Hierarchy

    Index

    Constructors

    constructor

    Properties

    Private Readonly _children

    _children: SubCommand[] = []
    +

    Returns SubCommandGroup

    Properties

    Private Readonly _children

    _children: SubCommand[] = []

    Group members (children)

    -
    readonly

    Readonly default_permission

    default_permission: boolean
    +
    readonly

    Readonly default_permission

    default_permission: boolean

    Discord API default_permission

    -
    readonly

    Readonly description

    description: string
    +
    readonly

    Readonly description

    description: string

    Group description (default: "No description")

    -
    readonly

    Readonly manager

    +
    readonly

    Readonly manager

    Manager in which this command is registered

    -
    readonly

    Readonly name

    name: string
    +
    readonly

    Readonly name

    name: string

    Command name

    -
    readonly

    Readonly parent

    parent: ChatCommand
    +
    readonly

    Readonly parent

    parent: ChatCommand

    Group parent command

    -
    readonly

    Readonly type

    +
    readonly

    Readonly type

    CommandBot's internal command type

    -
    readonly

    Accessors

    children

    Accessors

    children

    Methods

    append

    Methods

    append

    isBaseCommandType

    isBaseCommandType

    isChildCommandType

    isChildCommandType

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    isCommandType

    • isCommandType<T>(type: T): this is Commands<T>

    toObject

    toObject

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/SystemMessageManager.html b/docs/classes/SystemMessageManager.html index 69e59f9..ccca6f3 100644 --- a/docs/classes/SystemMessageManager.html +++ b/docs/classes/SystemMessageManager.html @@ -2,21 +2,21 @@

    Stores configuration and generates system messages

    System messages - predefined messages sent by the bot in special cases (for example after an error, or when a command doesn't exist)

    remarks

    You can't customize messages after starting the bot. Changing these properties while the bot is running will have no effect.

    -

    Hierarchy

    Index

    Constructors

    constructor

    Properties

    ERROR

    +

    Hierarchy

    • SystemMessageManager

    Index

    Constructors

    constructor

    Properties

    ERROR

    Sent when an error occurs during the execution of a command

    -

    NOT_FOUND

    +

    NOT_FOUND

    Sent when someone tries to run a command that does not exist (mainly by using prefix interactions)

    -

    PERMISSION

    +

    PERMISSION

    Sent whenever caller's permissions are not sufficient to run a command

    -

    SUCCESS

    +

    SUCCESS

    Sent when a command function returns void without throwing an error

    remarks

    An announceSuccess property must be set to true (default) in order to send this message

    -

    Readonly client

    client: Bot
    +

    Readonly client

    client: Bot

    Client parent attached to this manager

    -
    readonly

    deleteTimeout

    deleteTimeout: number
    +
    readonly

    deleteTimeout

    deleteTimeout: number

    Global time (in ms) after a message gets deleted

    remarks

    This time applies to all message types but it can be overwritten using local properties with the same name (for example ERROR.deleteTimeout)

    -

    Methods

    send

    • send(type: MessageType, data?: SystemMessageData, interaction?: Message | Interaction | TextChannel | DMChannel): Promise<void | Message | MessageEmbed>

    Methods

    send

    • send(type: MessageType, data?: SystemMessageData, interaction?: Message | Interaction | TextChannel | DMChannel): Promise<void | Message | MessageEmbed>
    @@ -198,6 +199,14 @@

    WARNING! You can't customize these messages after starting the bot. Changing these properties while the bot is running will have no effect.

    + +

    Experimental features

    +
    +
      +
    • The package has a PrefixManager class which is taking care of setting different prefixes for every server that the bot is on but there is no module to store that date in a file or database so the it's lost every time the application restarts. If you want to use it in your project, you should create a data store and write a function that dumps the data there.
    • +
    • CommandManager has 2 methods to interact with the Discord Permissions API (getPermissionsApi and setPermissionsApi) and set interaction permissions that are independent from the CommandBot permission system. This functionality has not been polished and fully tested yet.
    • +
    +

    Issues

    diff --git a/docs/interfaces/APICommandInit.html b/docs/interfaces/APICommandInit.html index a0d2315..12039fb 100644 --- a/docs/interfaces/APICommandInit.html +++ b/docs/interfaces/APICommandInit.html @@ -1,7 +1,7 @@ APICommandInit | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface APICommandInit

    Initialization options of core Command object

    -
    interface

    Hierarchy

    Index

    Properties

    Optional default_permission

    default_permission?: boolean
    +
    interface

    Hierarchy

    Index

    Properties

    Optional default_permission

    default_permission?: boolean

    Discord API default permission

    -

    name

    name: string
    +

    name

    name: string

    Command name

    Legend

    • Constructor
    • Property
    • Method
    • Inherited property
    • Inherited method
    • Private property
    • Private method
    • Static property
    • Static method
    • Property

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/APICommandObject.html b/docs/interfaces/APICommandObject.html index e6fcba1..a280206 100644 --- a/docs/interfaces/APICommandObject.html +++ b/docs/interfaces/APICommandObject.html @@ -1,7 +1,7 @@ APICommandObject | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface APICommandObject

    Discord base API command object

    -
    interface

    Hierarchy

    Index

    Properties

    default_permission

    default_permission: boolean
    +
    interface

    Hierarchy

    Index

    Properties

    default_permission

    default_permission: boolean

    Discord API default permission

    -

    name

    name: string
    +

    name

    name: string

    Command name

    Legend

    • Constructor
    • Property
    • Method
    • Inherited property
    • Inherited method
    • Private property
    • Private method
    • Static property
    • Static method
    • Property

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/ChatCommandInit.html b/docs/interfaces/ChatCommandInit.html index fa9f798..ec3870d 100644 --- a/docs/interfaces/ChatCommandInit.html +++ b/docs/interfaces/ChatCommandInit.html @@ -1,29 +1,29 @@ ChatCommandInit | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface ChatCommandInit

    Intialization options of chat command

    -
    interface

    Hierarchy

    Index

    Properties

    Optional aliases

    aliases?: string | string[]
    +
    interface

    Hierarchy

    Index

    Properties

    Optional aliases

    aliases?: string | string[]

    Different string that can be used with prefix to invoke the command

    -

    Optional announceSuccess

    announceSuccess?: boolean
    +

    Optional announceSuccess

    announceSuccess?: boolean

    Whether to send a built-in success message when the command has completed (if no other response is defined)

    -

    Optional default_permission

    default_permission?: boolean
    +

    Optional default_permission

    default_permission?: boolean

    Discord API default permission

    -

    Optional description

    description?: string
    +

    Optional description

    description?: string

    Command description

    -

    Optional dm

    dm?: boolean
    +

    Optional dm

    dm?: boolean

    Whether this command should be callable using private messages with bot

    -

    Optional function

    function?: CommandFunction
    +

    Optional function

    function?: CommandFunction

    Command function (will be executed when calling a command)

    -

    Optional guilds

    guilds?: string[]
    +

    Optional guilds

    guilds?: string[]

    List of Guild IDs in which the command can be called

    -

    name

    name: string
    +

    name

    name: string

    Command name

    -

    Optional parameters

    parameters?: ParameterSchema[] | "simple" | "no_input"
    +

    Optional parameters

    parameters?: ParameterSchema[] | "simple" | "no_input"

    List of object defining all parameters of the command

    -

    Optional permissions

    +

    Optional permissions

    Object with permissions' options and resolvables

    -

    Optional slash

    slash?: boolean
    +

    Optional slash

    slash?: boolean

    Whether this command should be registered as a slash command

    -

    Optional usage

    usage?: string
    +

    Optional usage

    usage?: string

    Command usage (if undefined, the usage will be automatically generated using parameters)

    -

    Optional visible

    visible?: boolean
    +

    Optional visible

    visible?: boolean

    Whether this command is visible in the help message

    Legend

    • Constructor
    • Property
    • Method
    • Inherited property
    • Inherited method
    • Private property
    • Private method
    • Static property
    • Static method
    • Property

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/ChatCommandObject.html b/docs/interfaces/ChatCommandObject.html index f87531a..bb56fdc 100644 --- a/docs/interfaces/ChatCommandObject.html +++ b/docs/interfaces/ChatCommandObject.html @@ -1,13 +1,13 @@ ChatCommandObject | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface ChatCommandObject

    Discord CHAT_INPUT command object

    -
    interface

    Hierarchy

    Index

    Properties

    default_permission

    default_permission: boolean
    +
    interface

    Hierarchy

    Index

    Properties

    default_permission

    default_permission: boolean

    Discord API default permission

    -

    description

    description: string
    +

    description

    description: string

    Command description

    -

    name

    name: string
    +

    name

    name: string

    Command name

    -

    Optional options

    +

    Optional options

    Command options/parameters

    -

    type

    type: 1
    +

    type

    type: 1

    Command type (forced to 1)

    Legend

    • Constructor
    • Property
    • Method
    • Inherited property
    • Inherited method
    • Private property
    • Private method
    • Static property
    • Static method
    • Property

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/ChatCommandOptionObject.html b/docs/interfaces/ChatCommandOptionObject.html index 4e7c449..4dadb74 100644 --- a/docs/interfaces/ChatCommandOptionObject.html +++ b/docs/interfaces/ChatCommandOptionObject.html @@ -1,16 +1,16 @@ ChatCommandOptionObject | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface ChatCommandOptionObject

    Discord CHAT_INPUT command option object

    -
    interface

    Hierarchy

    • ChatCommandOptionObject

    Index

    Properties

    Optional choices

    +
    interface

    Hierarchy

    • ChatCommandOptionObject

    Index

    Properties

    Optional choices

    List of command option choices

    remarks

    type must be set to 3 in order to implement choices

    -

    description

    description: string
    +

    description

    description: string

    Parameter description

    -

    name

    name: string
    +

    name

    name: string

    Parameter name

    -

    Optional options

    +

    Optional options

    Discord nested options/parameters

    -

    Optional required

    required?: boolean
    +

    Optional required

    required?: boolean

    Whether this parameter is required to complete the request (command)\

    -

    type

    +

    type

    Parameter type

    Legend

    • Constructor
    • Property
    • Method
    • Inherited property
    • Inherited method
    • Private property
    • Private method
    • Static property
    • Static method
    • Property

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/CommandPermission.html b/docs/interfaces/CommandPermission.html index c911842..a960cbd 100644 --- a/docs/interfaces/CommandPermission.html +++ b/docs/interfaces/CommandPermission.html @@ -1,3 +1,3 @@ CommandPermission | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface CommandPermission

    Discord permissions object

    -

    Hierarchy

    • CommandPermission

    Index

    Properties

    id

    id: string

    permission

    permission: boolean

    type

    Legend

    • Constructor
    • Property
    • Method
    • Inherited property
    • Inherited method
    • Private property
    • Private method
    • Static property
    • Static method
    • Property

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +

    Hierarchy

    • CommandPermission

    Index

    Properties

    id

    id: string

    permission

    permission: boolean

    type

    Legend

    • Constructor
    • Property
    • Method
    • Inherited property
    • Inherited method
    • Private property
    • Private method
    • Static property
    • Static method
    • Property

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/CommandPermissionsInit.html b/docs/interfaces/CommandPermissionsInit.html index c4bf0c1..87b8980 100644 --- a/docs/interfaces/CommandPermissionsInit.html +++ b/docs/interfaces/CommandPermissionsInit.html @@ -1,7 +1,7 @@ CommandPermissionsInit | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface CommandPermissionsInit

    Command permissions initialization object

    -
    interface

    Hierarchy

    • CommandPermissionsInit

    Index

    Properties

    Optional checkType

    +
    interface

    Hierarchy

    • CommandPermissionsInit

    Index

    Properties

    Optional checkType

    Whether to check if the caller has all defined permissions or at least one of them (applies only if the command uses Discord.js permission system)

    -

    Optional resolvable

    resolvable?: PermissionResolvable | PermissionFunction
    +

    Optional resolvable

    resolvable?: PermissionResolvable | PermissionFunction

    Resolvable (Discord.js permission resolvables) or custom function that returns boolean value

    Legend

    • Constructor
    • Property
    • Method
    • Inherited property
    • Inherited method
    • Private property
    • Private method
    • Static property
    • Static method
    • Property

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/ContextMenuCommandInit.html b/docs/interfaces/ContextMenuCommandInit.html index 253dbd9..49ae5a7 100644 --- a/docs/interfaces/ContextMenuCommandInit.html +++ b/docs/interfaces/ContextMenuCommandInit.html @@ -1,19 +1,19 @@ ContextMenuCommandInit | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface ContextMenuCommandInit

    Initialization options of context menu interactions

    -
    interface

    Hierarchy

    Index

    Properties

    Optional announceSuccess

    announceSuccess?: boolean
    +
    interface

    Hierarchy

    Index

    Properties

    Optional announceSuccess

    announceSuccess?: boolean

    Whether to send a built-in success message when the command has completed (if no other response is defined)

    -

    contextType

    contextType: ContextType
    +

    contextType

    contextType: ContextType

    Context menu target type

    -

    Optional default_permission

    default_permission?: boolean
    +

    Optional default_permission

    default_permission?: boolean

    Discord API default permission

    -

    Optional dm

    dm?: boolean
    +

    Optional dm

    dm?: boolean

    Whether this command should be callable using private messages with bot

    -

    Optional function

    function?: CommandFunction
    +

    Optional function

    function?: CommandFunction

    Command function (will be executed when calling a command)

    -

    Optional guilds

    guilds?: string[]
    +

    Optional guilds

    guilds?: string[]

    List of Guild IDs in which the command can be called

    -

    name

    name: string
    +

    name

    name: string

    Command name

    -

    Optional permissions

    +

    Optional permissions

    Object with permissions' options and resolvables

    Legend

    • Constructor
    • Property
    • Method
    • Inherited property
    • Inherited method
    • Private property
    • Private method
    • Static property
    • Static method
    • Property

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/ContextMenuCommandObject.html b/docs/interfaces/ContextMenuCommandObject.html index ee7b58e..0f4b2ce 100644 --- a/docs/interfaces/ContextMenuCommandObject.html +++ b/docs/interfaces/ContextMenuCommandObject.html @@ -1,7 +1,7 @@ ContextMenuCommandObject | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface ContextMenuCommandObject

    Context menu command object

    -
    interface

    Hierarchy

    Index

    Properties

    default_permission

    default_permission: boolean
    +
    interface

    Hierarchy

    Index

    Properties

    default_permission

    default_permission: boolean

    Discord API default permission

    -

    name

    name: string
    +

    name

    name: string

    Command name

    -

    type

    type: 3 | 2

    Legend

    • Constructor
    • Property
    • Method
    • Inherited property
    • Inherited method
    • Private property
    • Private method
    • Static property
    • Static method
    • Property

    Settings

    Theme

    Generated using TypeDoc

    \ No newline at end of file +

    type

    type: 3 | 2

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/FunctionCommandInit.html b/docs/interfaces/FunctionCommandInit.html index 9f96e30..30b8c41 100644 --- a/docs/interfaces/FunctionCommandInit.html +++ b/docs/interfaces/FunctionCommandInit.html @@ -1,11 +1,11 @@ FunctionCommandInit | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface FunctionCommandInit

    Initialization options of base executable command

    -
    interface

    Hierarchy

    Index

    Properties

    Optional announceSuccess

    announceSuccess?: boolean
    +
    interface

    Hierarchy

    Index

    Properties

    Optional announceSuccess

    announceSuccess?: boolean

    Whether to send a built-in success message when the command has completed (if no other response is defined)

    -

    Optional default_permission

    default_permission?: boolean
    +

    Optional default_permission

    default_permission?: boolean

    Discord API default permission

    -

    Optional function

    function?: CommandFunction
    +

    Optional function

    function?: CommandFunction

    Command function (will be executed when calling a command)

    -

    name

    name: string
    +

    name

    name: string

    Command name

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/GuildCommandInit.html b/docs/interfaces/GuildCommandInit.html index 3b818e0..b7d25fd 100644 --- a/docs/interfaces/GuildCommandInit.html +++ b/docs/interfaces/GuildCommandInit.html @@ -1,15 +1,15 @@ GuildCommandInit | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface GuildCommandInit

    Initialization options of base guild-scoped command

    -
    interface

    Hierarchy

    Index

    Properties

    Optional announceSuccess

    announceSuccess?: boolean
    +
    interface

    Hierarchy

    Index

    Properties

    Optional announceSuccess

    announceSuccess?: boolean

    Whether to send a built-in success message when the command has completed (if no other response is defined)

    -

    Optional default_permission

    default_permission?: boolean
    +

    Optional default_permission

    default_permission?: boolean

    Discord API default permission

    -

    Optional dm

    dm?: boolean
    +

    Optional dm

    dm?: boolean

    Whether this command should be callable using private messages with bot

    -

    Optional function

    function?: CommandFunction
    +

    Optional function

    function?: CommandFunction

    Command function (will be executed when calling a command)

    -

    Optional guilds

    guilds?: string[]
    +

    Optional guilds

    guilds?: string[]

    List of Guild IDs in which the command can be called

    -

    name

    name: string
    +

    name

    name: string

    Command name

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/HelpMessageParams.html b/docs/interfaces/HelpMessageParams.html index 49afc8a..3782c5d 100644 --- a/docs/interfaces/HelpMessageParams.html +++ b/docs/interfaces/HelpMessageParams.html @@ -1,17 +1,17 @@ HelpMessageParams | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface HelpMessageParams

    All properties used to customize the appearance of a help message

    -
    interface

    Hierarchy

    • HelpMessageParams

    Index

    Properties

    bottomText

    bottomText: string
    +
    interface

    Hierarchy

    • HelpMessageParams

    Index

    Properties

    bottomText

    bottomText: string

    Text below the title

    -

    color

    color: ColorResolvable
    +

    color

    color: ColorResolvable

    Color of a message

    -

    description

    description: string
    +

    description

    description: string

    Description of the "help" command

    -

    enabled

    enabled: boolean
    +

    enabled

    enabled: boolean

    Whether help message is enabled

    -

    title

    title: string
    +

    title

    title: string

    Title field

    -

    usage

    usage: string
    +

    usage

    usage: string

    Usage of the "help" command

    -

    visible

    visible: boolean
    +

    visible

    visible: boolean

    Whether the "help" command should be visible in the help message

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/InitOptions.html b/docs/interfaces/InitOptions.html index 8c153db..d0892dc 100644 --- a/docs/interfaces/InitOptions.html +++ b/docs/interfaces/InitOptions.html @@ -1,20 +1,20 @@ InitOptions | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface InitOptions

    Main object initialization options

    -
    interface

    Hierarchy

    • InitOptions

    Index

    Properties

    applicationId

    applicationId: string
    +
    interface

    Hierarchy

    • InitOptions

    Index

    Properties

    applicationId

    applicationId: string

    Discord API application ID

    -

    Optional argumentSeparator

    argumentSeparator?: string
    +

    Optional argumentSeparator

    argumentSeparator?: string

    Separator used to split user input to a list of InputParameters (applies to prefix interactions)

    -

    Optional clientOptions

    clientOptions?: ClientOptions
    +

    Optional clientOptions

    clientOptions?: ClientOptions

    Additional ClientOptions for Discord.js Client object

    -

    Optional commandSeparator

    commandSeparator?: string
    +

    Optional commandSeparator

    commandSeparator?: string

    Separator used to split subcommands when using prefix interactions

    -

    Optional globalPrefix

    globalPrefix?: string
    +

    Optional globalPrefix

    globalPrefix?: string

    Prefix used as a way to trigger the bot using messages in all guilds by default

    remarks

    If undefined, you can only interact with bot using slash commands or context menus

    -

    Optional help

    +

    Optional help

    Help message appearance configuration

    -

    name

    name: string
    +

    name

    name: string

    Bot name

    -

    token

    token: string
    +

    token

    token: string

    Discord bot token

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/ParameterSchema.html b/docs/interfaces/ParameterSchema.html index 94e35b3..a4660a7 100644 --- a/docs/interfaces/ParameterSchema.html +++ b/docs/interfaces/ParameterSchema.html @@ -1,14 +1,14 @@ ParameterSchema | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface ParameterSchema

    Properties required to build a Parameter object

    -
    interface

    Hierarchy

    • ParameterSchema

    Index

    Properties

    Optional choices

    choices?: string[]
    +
    interface

    Hierarchy

    • ParameterSchema

    Index

    Properties

    Optional choices

    choices?: string[]

    List of value choices

    remarks

    Available only when type is set to "string"

    -

    Optional description

    description?: string
    +

    Optional description

    description?: string

    Parameter description

    -

    name

    name: string
    +

    name

    name: string

    Parameter name

    -

    optional

    optional: boolean
    +

    optional

    optional: boolean

    Whether this parameter is optional

    -

    type

    +

    type

    Type of parameter data

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/PermissionCommandInit.html b/docs/interfaces/PermissionCommandInit.html index f024844..8b600d1 100644 --- a/docs/interfaces/PermissionCommandInit.html +++ b/docs/interfaces/PermissionCommandInit.html @@ -1,13 +1,13 @@ PermissionCommandInit | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface PermissionCommandInit

    Initialization options of base command with attached permissions

    -
    interface

    Hierarchy

    Index

    Properties

    Optional announceSuccess

    announceSuccess?: boolean
    +
    interface

    Hierarchy

    Index

    Properties

    Optional announceSuccess

    announceSuccess?: boolean

    Whether to send a built-in success message when the command has completed (if no other response is defined)

    -

    Optional default_permission

    default_permission?: boolean
    +

    Optional default_permission

    default_permission?: boolean

    Discord API default permission

    -

    Optional function

    function?: CommandFunction
    +

    Optional function

    function?: CommandFunction

    Command function (will be executed when calling a command)

    -

    name

    name: string
    +

    name

    name: string

    Command name

    -

    Optional permissions

    +

    Optional permissions

    Object with permissions' options and resolvables

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/PermissionGuildCommandInit.html b/docs/interfaces/PermissionGuildCommandInit.html index 42f01a1..f81211c 100644 --- a/docs/interfaces/PermissionGuildCommandInit.html +++ b/docs/interfaces/PermissionGuildCommandInit.html @@ -1,17 +1,17 @@ PermissionGuildCommandInit | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface PermissionGuildCommandInit

    Initialization options of base guild-scoped command with attached permisisions

    -
    interface

    Hierarchy

    Index

    Properties

    Optional announceSuccess

    announceSuccess?: boolean
    +
    interface

    Hierarchy

    Index

    Properties

    Optional announceSuccess

    announceSuccess?: boolean

    Whether to send a built-in success message when the command has completed (if no other response is defined)

    -

    Optional default_permission

    default_permission?: boolean
    +

    Optional default_permission

    default_permission?: boolean

    Discord API default permission

    -

    Optional dm

    dm?: boolean
    +

    Optional dm

    dm?: boolean

    Whether this command should be callable using private messages with bot

    -

    Optional function

    function?: CommandFunction
    +

    Optional function

    function?: CommandFunction

    Command function (will be executed when calling a command)

    -

    Optional guilds

    guilds?: string[]
    +

    Optional guilds

    guilds?: string[]

    List of Guild IDs in which the command can be called

    -

    name

    name: string
    +

    name

    name: string

    Command name

    -

    Optional permissions

    +

    Optional permissions

    Object with permissions' options and resolvables

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/RegisteredCommandObject.html b/docs/interfaces/RegisteredCommandObject.html index 79c5580..c5542ff 100644 --- a/docs/interfaces/RegisteredCommandObject.html +++ b/docs/interfaces/RegisteredCommandObject.html @@ -1,3 +1,3 @@ RegisteredCommandObject | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface RegisteredCommandObject

    Discord registered command object

    -

    Hierarchy

    • RegisteredCommandObject

    Index

    Properties

    application_id

    application_id: string

    Optional default_permissions

    default_permissions?: boolean

    description

    description: string

    Optional guild_id

    guild_id?: string

    id

    id: string

    name

    name: string

    Optional options

    Optional type

    type?: number

    version

    version: string

    Generated using TypeDoc

    \ No newline at end of file +

    Hierarchy

    Index

    Properties

    application_id

    application_id: string

    Optional default_permissions

    default_permissions?: boolean

    description

    description: string

    Optional guild_id

    guild_id?: string

    id

    id: string

    name

    name: string

    Optional options

    Optional type

    type?: number

    version

    version: string

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/SubCommandGroupInit.html b/docs/interfaces/SubCommandGroupInit.html index ac8bd89..c55af6d 100644 --- a/docs/interfaces/SubCommandGroupInit.html +++ b/docs/interfaces/SubCommandGroupInit.html @@ -1,9 +1,9 @@ SubCommandGroupInit | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface SubCommandGroupInit

    Intialization options of subcommand group

    -
    interface

    Hierarchy

    Index

    Properties

    Optional default_permission

    default_permission?: boolean
    +
    interface

    Hierarchy

    Index

    Properties

    Optional default_permission

    default_permission?: boolean

    Discord API default permission

    -

    Optional description

    description?: string
    +

    Optional description

    description?: string

    Command description

    -

    name

    name: string
    +

    name

    name: string

    Command name

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/SubCommandGroupObject.html b/docs/interfaces/SubCommandGroupObject.html index 6094022..f917e3e 100644 --- a/docs/interfaces/SubCommandGroupObject.html +++ b/docs/interfaces/SubCommandGroupObject.html @@ -1,7 +1,7 @@ SubCommandGroupObject | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface SubCommandGroupObject

    API representation of subcommand group

    -

    Hierarchy

    Index

    Properties

    default_permission

    default_permission: boolean
    +

    Hierarchy

    Index

    Properties

    default_permission

    default_permission: boolean

    Discord API default permission

    -

    description

    description: string

    name

    name: string
    +

    description

    description: string

    name

    name: string

    Command name

    -

    options

    type

    type: 2

    Generated using TypeDoc

    \ No newline at end of file +

    options

    type

    type: 2

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/SubCommandInit.html b/docs/interfaces/SubCommandInit.html index 1f8d06e..3f3264a 100644 --- a/docs/interfaces/SubCommandInit.html +++ b/docs/interfaces/SubCommandInit.html @@ -1,19 +1,19 @@ SubCommandInit | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface SubCommandInit

    Subcommand initialization options

    -
    interface

    Hierarchy

    Index

    Properties

    Optional announceSuccess

    announceSuccess?: boolean
    +
    interface

    Hierarchy

    Index

    Properties

    Optional announceSuccess

    announceSuccess?: boolean

    Whether to send a built-in success message when the command has completed (if no other response is defined)

    -

    Optional default_permission

    default_permission?: boolean
    +

    Optional default_permission

    default_permission?: boolean

    Discord API default permission

    -

    Optional description

    description?: string
    +

    Optional description

    description?: string

    Command description

    -

    Optional function

    function?: CommandFunction
    +

    Optional function

    function?: CommandFunction

    Command function (will be executed when calling a command)

    -

    name

    name: string
    +

    name

    name: string

    Command name

    -

    Optional parameters

    parameters?: ParameterSchema[] | "simple" | "no_input"
    +

    Optional parameters

    parameters?: ParameterSchema[] | "simple" | "no_input"

    List of object defining all parameters of the command

    -

    Optional permissions

    +

    Optional permissions

    Object with permissions' options and resolvables

    -

    Optional usage

    usage?: string
    +

    Optional usage

    usage?: string

    Command usage (if undefined, the usage will be automatically generated using parameters)

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/SystemMessageAppearance.html b/docs/interfaces/SystemMessageAppearance.html index 7ae9c82..5a23e24 100644 --- a/docs/interfaces/SystemMessageAppearance.html +++ b/docs/interfaces/SystemMessageAppearance.html @@ -1,20 +1,20 @@ SystemMessageAppearance | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface SystemMessageAppearance

    Configuration of a system message

    -
    interface

    Hierarchy

    • SystemMessageAppearance

    Index

    Properties

    Optional accentColor

    accentColor?: ColorResolvable
    +
    interface

    Hierarchy

    • SystemMessageAppearance

    Index

    Properties

    Optional accentColor

    accentColor?: ColorResolvable

    Color of a message

    -

    Optional bottomText

    bottomText?: string
    +

    Optional bottomText

    bottomText?: string

    Text below the title

    -

    Optional deleteTimeout

    deleteTimeout?: number
    +

    Optional deleteTimeout

    deleteTimeout?: number

    Time (in ms) after a message of this type gets deleted

    remarks

    Set to Infinity to not delete the message

    -

    Optional displayDetails

    displayDetails?: boolean
    +

    Optional displayDetails

    displayDetails?: boolean

    Whether to display detailed informations in the message

    -

    enabled

    enabled: boolean
    +

    enabled

    enabled: boolean

    Whether this type of message is enabled

    -

    Optional footer

    footer?: string
    +

    Optional footer

    footer?: string

    Footer text

    -

    Optional showTimestamp

    showTimestamp?: boolean
    +

    Optional showTimestamp

    showTimestamp?: boolean

    Whether to show current time and date in a footer

    -

    title

    title: string
    +

    title

    title: string

    Title field

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/SystemMessageData.html b/docs/interfaces/SystemMessageData.html index c40c510..69b694d 100644 --- a/docs/interfaces/SystemMessageData.html +++ b/docs/interfaces/SystemMessageData.html @@ -1,11 +1,11 @@ SystemMessageData | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface SystemMessageData

    System message data definition

    -
    interface

    Hierarchy

    • SystemMessageData

    Index

    Properties

    Optional command

    command?: Command
    +
    interface

    Hierarchy

    • SystemMessageData

    Index

    Properties

    Optional command

    command?: Command

    A Command instance

    -

    Optional error

    error?: string | Error | PermissionsError
    +

    Optional error

    error?: string | Error | PermissionsError

    Error object

    -

    Optional phrase

    phrase?: string
    +

    Optional phrase

    phrase?: string

    Phrase received from a Discord channel

    -

    Optional user

    user?: GuildMember | User
    +

    Optional user

    user?: GuildMember | User

    User who used the bot

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/TextCommandOptionChoiceObject.html b/docs/interfaces/TextCommandOptionChoiceObject.html index fc4c155..a109711 100644 --- a/docs/interfaces/TextCommandOptionChoiceObject.html +++ b/docs/interfaces/TextCommandOptionChoiceObject.html @@ -1,3 +1,3 @@ TextCommandOptionChoiceObject | commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    Interface TextCommandOptionChoiceObject

    Discord CHAT_INPUT command choice object

    -
    interface

    Hierarchy

    • TextCommandOptionChoiceObject

    Index

    Properties

    Properties

    name

    name: string

    value

    value: string

    Generated using TypeDoc

    \ No newline at end of file +
    interface

    Hierarchy

    Index

    Properties

    Properties

    name

    name: string

    value

    value: string

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/modules.html b/docs/modules.html index 92f8af5..b8380e9 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -1,23 +1,23 @@ -commandbot
    Options
    All
    • Public
    • Public/Protected
    • All
    Menu

    commandbot

    Index

    Type aliases

    APICommandType

    APICommandType: "CHAT_INPUT" | "USER" | "MESSAGE"
    +commandbot
    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"
    +

    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
    +

    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
    +

    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
    +

    ChildCommandInit

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

    Child command initializer selector

    -

    Type parameters

    ChildCommandResolvable

    ChildCommandResolvable: SubCommandGroup | SubCommand
    +

    Type parameters

    ChildCommandResolvable

    ChildCommandResolvable: SubCommandGroup | SubCommand

    Child command resolvables

    -

    ChildCommandType

    ChildCommandType: "COMMAND" | "GROUP"
    +

    ChildCommandType

    ChildCommandType: "COMMAND" | "GROUP"

    Child command types

    -

    ChildCommands

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

    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

    CommandFunction

    CommandFunction: (input: InputManager) => CommandFunctionReturnTypes

    Type declaration

      • Command function definition

        If function returns (also after resolving a Promise):

          @@ -29,29 +29,29 @@ MESSAGE - context menu interaction for message

          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>
    +

    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
    +

    CommandInit

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

    Command initializer selector

    -

    Type parameters

    CommandPermissionType

    CommandPermissionType: "ROLE" | "USER"
    +

    Type parameters

    CommandPermissionType

    CommandPermissionType: "ROLE" | "USER"

    Discord permission types

    -

    CommandType

    CommandType: "CHAT" | "CONTEXT"
    +

    CommandType

    CommandType: "CHAT" | "CONTEXT"

    Command types

    -

    Commands

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

    Commands

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

    Command type selector

    -

    Type parameters

    ContextType

    ContextType: "USER" | "MESSAGE"
    +

    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
    -

    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
    +

    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"
    +

    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
    +

    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"
    +

    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
    • @@ -59,25 +59,25 @@ MESSAGE - context menu interaction for message

    • 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
    +

    ParameterResolvable

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

    All parameter resolvables

    -

    ParameterType

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

    ParameterType

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

    Parameter type values

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

    PermissionCheckTypes

    PermissionCheckTypes: "ALL" | "ANY"
    +

    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
      • +

    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
    +

    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
    +

    TargetIdReturnType

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

    TargetID.prototype.toObject() return type selector*

    -

    Type parameters

    TargetType

    TargetType: "MESSAGE" | "USER"
    +

    Type parameters

    TargetType

    TargetType: "MESSAGE" | "USER"

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

    Generated using TypeDoc

    \ No newline at end of file diff --git a/src/commands/ChatCommand.ts b/src/commands/ChatCommand.ts index 5c60985..bea24b6 100644 --- a/src/commands/ChatCommand.ts +++ b/src/commands/ChatCommand.ts @@ -157,7 +157,7 @@ export class ChatCommand extends PermissionGuildCommand { } /** - * Attaches subcommand or subcommand group to this ChatCommand (this makes the base command usable only via prefix interactions) + * Attaches subcommand or subcommand group to this ChatCommand * @param {T} type - subcommand type * @param {ChildCommandInit} options - initialization options * @returns {ChildCommands} A computed subcommand object diff --git a/src/structures/CommandManager.ts b/src/structures/CommandManager.ts index 05e074e..bd89a6b 100644 --- a/src/structures/CommandManager.ts +++ b/src/structures/CommandManager.ts @@ -478,6 +478,7 @@ export class CommandManager { * @returns {Promise} * @public * @async + * @experimental This functionality hasn't been polished and fully tested yet. Using it might lead to errors and application crashes. */ public async setPermissionsApi(id: string, permissions: CommandPermission[], g?: Guild | string) { if (typeof g === "string" && !this.client.client.guilds.cache.get(g)) throw new Error(`${g} is not a valid guild id`); @@ -503,6 +504,7 @@ export class CommandManager { * @param {Guild | string} [g] - Guild ID or object (if command is in a guild) * @public * @async + * @experimental This functionality hasn't been polished and fully tested yet. Using it might lead to errors and application crashes. */ public async getPermissionsApi(id: string, g?: Guild | string) { if (typeof g === "string" && !this.client.client.guilds.cache.get(g)) throw new Error(`${g} is not a valid guild id`); diff --git a/src/structures/PrefixManager.ts b/src/structures/PrefixManager.ts index 8ea1b34..b264bd6 100644 --- a/src/structures/PrefixManager.ts +++ b/src/structures/PrefixManager.ts @@ -3,6 +3,11 @@ import { CommandManager } from "./CommandManager.js"; import { CommandRegExps } from "../commands/types/commands.js"; import { ScopeResolvable } from "./types/PrefixManager.js"; +/** + * Maps server IDs with command prefixes and allows to manage them + * @class + * @experimental This feature should be fully functional but it doesn't store its data in any kind of local storage or cache. All informations get lost after restarting the application. It is possible to create a store for that data (exporting to a file or in some kind of database) and then load it every time the application starts. + */ export class PrefixManager { /** * Prefixes data