Commands

Interact with your server from Discord

Overview

Ever wanted to run a command against your server, but don't have the game loaded up? Well, now you can create custom commands that can be run directly from your Discord client!

A quick showcase of commands

Configuration

Enable Commands

Controls whether or not the command client should be enabled.

config/chatter/discord/commands.json5
{
	// True if any commands should be available for use
	"enabled": true,
	// ...
}

Command Prefix

A prefix that when included in a Discord message, will treat the request as a command.

config/chatter/discord/commands.json5
{
	// Message prefix used in Discord to trigger commands
	"prefix": "!",
	// ...
}

Help Menu

By defining a help word, a command will be automatically registered that sends a direct message containing all available commands and their usage.

Example help menu
config/chatter/discord/commands.json5
{
	// If defined, exposes a command to display help
	"helpWord": "help",
	// ...
}

Admins

A command administrator will skip all permission checks, hence, having access to all commands.

config/chatter/discord/commands.json5
{
	// Identifiers for users within Discord to whom to grant all permissions
	"admins": [
		"252311115122475009",
		// ...
	],
	// ...
}
Finding a Discord user identifer

Messages

There are some instances where feedback is provided. In these cases, the following messages may be sent.

config/chatter/discord/commands.json5
{
	// Feedback provided to the user who triggered a command
	"messages": {
		// The error message used when the server is unavailable
		"unavailable": "The server is not yet ready - please wait. :warning:"
		// ...
	},
	// ...
}

Command

There are two types of commands, built-in and custom. Both share a common set of base command options, as defined below.

Built-InCustom

Enabled

Controls whether or not the command should be registered.

// True if the command should be available for use
"enabled": true,

Name

A trigger keyword that comes directly after the message prefix, to use the command.

// Trigger name for the command
"name": "teleport",

Aliases

Alternative trigger keywords in addition to the above name.

// Any alternative trigger names for the command
"aliases": [
	"tp",
	// ...
],

Help

A description of what the command does - this is used in the help menu.

// A brief description of what the command does
"help": "Teleports a player",

Usage

Details the correct usage of the command - this is used in the help menu.

// Details the correct usage of the command, e.g. <username> [count]
"usage": "<username> [x] [y] [z]",

Hidden

Controls whether this command should be visible in the help menu.

// True if the command should be hidden from help messages
"hidden": false,

Role

If defined, restricts access to Discord users who have the specified role.

// If defined, restricts access to Discord users with the given role identifier or name
"role": "Admin",

Cooldown

Specifies how often the command may be used, in seconds. A cooldown can be scoped accordingly.

Scope

Meaning

USER

Per-user, across all locations, e.g. text/private channels, guild, etc.

CHANNEL

Per-channel that the command was called in

USER_CHANNEL

Per-user, per-channel that the command was called in

GUILD

All users, per-guild, e.g. an entire Discord server

USER_GUILD

Per-guild, per-user, e.g. John Doe in server A and John Doe in server B

GLOBAL

Global, every server, channel and user, e.g. if stopping the server, only ever call once

// The number of seconds a user must wait before using the command again
"cooldown": 0,
// To whom the cooldown applies (see https://git.io/JtpsJ)
"cooldownScope": "USER",

Last updated

Was this helpful?