Class SlashCommandBuilder<TOpts>

Type Parameters

  • TOpts

Constructors

Methods

  • Adds a option/argument to this command.

    Each type of option has different settings you can adjust, but all of them have a "required" field that defaults to true, you can set it to false for optional options.

    Type Parameters

    • TKey extends string

    • TKind extends "Role" | "String" | "Integer" | "Boolean" | "User" | "Channel" | "Mentionable" | "Number" | "Attachment"

    • TRequired extends undefined | boolean

    Parameters

    • name: TKey

      Name of the option, 1-32 characters (no symbols except - and _)

    • kind: TKind

      What type of option this is

    • description: string

      Description of the option, 1-100 characters long

    • Optional opts: OptionsKindTable[TKind] & BaseOptionSettings<TRequired>

      Additional options, depends on what "kind" you pass but all options has a "required" field that defaults to true

    Returns SlashCommandBuilder<LayerOption<TOpts, TKey, {
        kind: TKind;
        required: TRequired;
    }>>

  • Build the command, providing a callback that runs when the command gets executed

    Parameters

    • callback: ((ctx, args) => void | Promise<any>)

    Returns Command

    The built command, if you used script.createSlashCommand you can ignore the return value but if not you pass it to @{link Script.createCommand} to actually create it on discord

  • Sets the flags for the mssage sent when sending the intial interaction response. Epehemeral means that it can only be see by the person issuing the command.

    Parameters

    Returns SlashCommandBuilder<TOpts>

  • Set the ack mode of this command (if you're experienced with the discord api, this is the callback type to the interaction)

    DeferredMessage: It will respond with a deferred message, using the flags from setAckMessageFlags. Custom: You handle the ack'ing of the interaction yourself, this allows you to use modals.

    Keep in mind when using custom, you have to ack the interaction within 3 seconds otherwise it will fail.

    Parameters

    Returns SlashCommandBuilder<TOpts>

  • Assigns a group to this command

    Parameters

    Returns SlashCommandBuilder<TOpts>

    Example

    const group = new Commands.Group("some-group", "some description")
    script.addCommand(Commands.slashCommand("some-cmd", "some description").setGroup(grou).build(...))

Generated using TypeDoc