Module SlashCreate.SlashCreator

type t;

The main class for using commands and interactions.

type params;
let params: applicationID:string => ?⁠publicKey:string => ?⁠token:string => ?⁠endpointPath:string => ?⁠serverHost:string => ?⁠serverPort:int => ?⁠unknownCommandResponse:bool => ?⁠autoAcknowledgeSource:bool => ?⁠allowedMentions:Message.allowedMentions => ?⁠defaultImageFormat:imageFormat => ?⁠defaultImageSize:int => ?⁠latencyThreshold:int => ?⁠ratelimiterOffset:int => ?⁠requestTimeout:int => ?⁠maxSignatureTimestamp:int => unit => params;

Constructs parameters for SlashCreator.createWith.

parameter applicationID

Your application's ID

parameter publicKey

The public key for your application. Required for webservers.

parameter token

The bot/client token for the application. Recommended to set this in your config.

parameter endpointPath

The path where the server will listen for interactions.

parameter serverPort

The port where the server will listen on.

parameter serverHost

The host where the server will listen on.

parameter unknownCommandResponse

Whether to respond to an unknown command with an ephemeral message. If an unknown command is registered, this is ignored.

parameter autoAcknowledgeSource

Whether to include source in the auto-acknowledgement timeout.

parameter allowedMentions

The default allowed mentions for all messages.

parameter defaultImageFormat

The default format to provide user avatars in.

parameter defaultImageSize

The default image size to provide user avatars in.

parameter latencyThreshold

The average latency where SlashCreate will start emitting warnings for.

parameter ratelimiterOffset

A number of milliseconds to offset the ratelimit timing calculations by.

parameter requestTimeout

A number of milliseconds before requests are considered timed out.

parameter maxSignatureTimestamp

A number of milliseconds before requests with a timestamp past that time get rejected.

parameter agent

A HTTP Agent used to proxy requests

let createWith: params => t;

Construct a SlashCreator.t; accepts options constructed by params.

let commandsPath: t => Js.undefined(string);

The path where the commands were loaded from. See registerCommandsIn, registerCommandsInPath.

let registerCommandsInPath: string => t => t;

Registers all commands in a directory. The files must export a Command class constructor or instance. This is a short form for registerCommandsIn.

parameter path

The path to the directory

see https://slash-create.js.org/#/docs/main/latest/class/SlashCreator?scrollTo=registerCommandsIn
let registerCommandsIn: requireAllParams => t => t;

Registers all commands in a directory. The files must export a Command class constructor or instance. See registerCommandsInPath for a shorter form.

parameter requireAllParams

Parameters constructed with requireAllParams

see https://slash-create.js.org/#/docs/main/latest/class/SlashCreator?scrollTo=registerCommandsIn
let syncCommandsWith: syncCommandParams => t => t;
let syncCommands: ?⁠deleteCommands:bool => ?⁠skipGuildErrors:bool => ?⁠syncGuilds:bool => t => t;

Sync all commands with Discord. This ensures that commands exist when handling them.

This requires you to have your token set in the creator config.

parameter deleteCommands

Whether to delete commands that do not exist in the creator.

parameter syncGuilds

Whether to sync guild-specific commands.

parameter skipGuildErrors

Whether to skip over guild syncing errors. (Guild syncs most likely can error if that guild no longer exists.)