Commands

Create powerful slash commands with simple syntax.

Basic Command

commands/ping.js
bot.command.new('ping', 'Pong!', async function() {
await this.reply('Pong!');
});

Syntax

bot.command.new(name, description, handler)

  • name - Command name (lowercase, no spaces)
  • description - What the command does
  • handler - Function to execute

Command Parameters

commands/greet.js
bot.command.new('greet', 'Greet someone', async function() {
const user = this.getUser('user') || this.user;
await this.reply(`Hello, ${user.username}!`);
}, [{
name: 'user',
description: 'User to greet',
type: 6, // User
required: false
}]);

Parameter Types

  • 3 - String
  • 4 - Integer
  • 5 - Boolean
  • 6 - User
  • 7 - Channel
  • 8 - Role

Context API

Inside command handler, this contains:

Interaction Methods

  • this.reply(content) - Reply to command
  • this.edit(content) - Edit reply
  • this.defer() - Defer for long operations
  • this.followUp(content) - Send follow-up

Data Access

  • this.user - Command user
  • this.guild - Current server
  • this.channel - Current channel
  • this.client - Discord.js client

Parameter Getters

  • this.getString('name') - Get string param
  • this.getInteger('amount') - Get integer
  • this.getUser('user') - Get user
  • this.getChannel('channel') - Get channel

Utilities

  • this.random.number(min, max) - Random number
  • this.random.bool() - Random boolean
  • this.emoji - Custom emojis
  • this.vals - Global values

More Examples

Random Number

commands/dice.js
bot.command.new('dice', 'Roll a dice', async function() {
const num = this.random.number(1, 6);
await this.reply(`🎲 You rolled: ${num}`);
});

User Info with Embed

commands/info.js
bot.command.new('info', 'User info', async function() {
const user = this.getUser('user') || this.user;
await this.reply({
embeds: [{
title: `Info: ${user.username}`,
fields: [
{ name: 'ID', value: user.id },
{ name: 'Tag', value: user.tag }
]
}]
});
});