Commands

Introduction to Commands

The primary entry point for any Discord bot is commands. In Seyfert, commands are defined using TypeScript decorators, making it easier to specify their properties, options, middlewares, and subcommands.

If you haven't created your first command yet, please refer to that introductory guide before proceeding.

Declaring a Command

All commands in Seyfert are class-based, and each class extends the base Command class.

Additionally, the name and description are mandatory properties for every command. Below is a list of possible properties that can be used with the @Declare decorator:

import { , ,  } from 'seyfert';
 
@({
    : 'your-command',
    : 'A description for this command',
    // Properties to pass as metadata
    : {},
 
    // List of permissions required by the member
    : ['Administrator'],
 
    // List of permissions required by the bot
    : ['ManageGuild'],
 
    // List of server IDs to register the command
    : ['100000'],
 
    // Determines if the command is NSFW
    : false,
 
    // List of alternate names for the command (text commands)
    : ['an-alias'],
 
    // Identifies the installation types the command supports,
    //   default is server-only
    : ['GuildInstall', 'UserInstall'],
 
    // Specifies where a command can be used
    : ['BotDM', 'Guild', 'PrivateChannel'],
 
    // Defines whether to ignore the execution of the command in slash
    //   or text-message versions
    : .
  • Message
  • Slash
,
// Sets the type of command: /// type: ApplicationCommandType.User }) class extends {}

On this page