Skip to content
This repository has been archived by the owner on Jan 28, 2024. It is now read-only.

How to command

Elias Schaut edited this page Oct 31, 2021 · 9 revisions

Add a command

  1. Create a new JS file named <command name>.js inside a folder in the folder commands.
    Note: Every command has to be in a folder in the folder commands. A command, which is directly in the folder commands or in a folder in a folder in commands is not allowed! But you can create own folders in commands.
  2. Fill the newly created JS file with the command skeleton
  3. Set the command modifications and write your execution code.

Command Skeleton

module.exports = {
    name: '<name>',
    description: '<help>',
    aliases: ['<alias_1>', '<alias_2>'],
    args_needed: false,
    args_min_length: 0,
    args_max_length: 0,
    usage: '<usage>',
    guild_only: false,
    dm_only: false,
    need_permission: ['<permission1>', '<permission2>'],
    admin_only: false,
    nsfw: false,
    disabled: false,
    enable_slash: false,
    execute(msg, args) {  // msg = discord.js 'Message' object; args = given arguments as list
        // your lovely code to execute
    },
};

Command Modifier

Key Description Value-Type Required
name The name of the command String + should be also the name of the file yes
description The description of the command. It will be shown in help command String yes
aliases Aliases for the command ['<String>', ..., '<String>'] no
args_needed If true, the command will only execute, if at least one argument is given. If args_min_length is set, the command needs at least this number of argument Boolean only if args_min_length is set
args_min_length The minimal number arguments, the command needs to be executed Number no
args_max_length The maximal number arguments, the command needs to be executed Number no
usage The description, how the arguments must look like String only if args_needed is set
guild_only If true the command runs only in guilds Boolean no
dm_only If true the command runs only in dms Boolean no
need_permission Users who want to execute the command need to have these permissions. ['<Discord-Permission>, ..., <Discord-Permission>'] (see Discord-Permissions) no
admin_only If true, only admins (see config file) can run this command Boolean no
nsfw If true, the command runs only in nfsw channels Boolean no
disabled If true, the command is not usable Boolean no
enable_slash If true, the command is addressable via slash-command Boolean no
Clone this wiki locally