Slash Commands

Slash commands are a new feature implemented into Discord and CDHandler, so they can have some "bugs"

Slash Command Options

  • name - [String] | Command name

  • slash - [Boolean or String] | false deletes the command, true creates the command, "Both" makes it a slash command and a normal command.

  • data - [Array with objects] | the options for the slash command servers - Array | List of guilds where the slash command will be created

  • description - [String] | The command description

  • usage - [String] | The command usage

  • example - [String] | A example

  • category - [String] | The category the command is in

  • hidden - [Boolean] | Makes the command completely invisible for help command

  • hidden2 - [Boolean] | Makes the command partially invisible for help command

Examples

JavaScript
TypeScript
CoffeeScript
JavaScript
// File Name - ping.js
const { MessageEmbed } = require('discord.js')
module.exports = {
name: "ping",
slash: true,
servers: ['814832821125775420'],
description: "poggers",
run: ({ message, args, client, handler, interaction }) => {
return "Pong!" // message which will be sent, always include return to don't crash
},
};
TypeScript
// File Name - ping.ts
import { MessageEmbed } from 'discord.js'
export default {
name: "ping",
slash: true,
servers: ['814832821125775420'],
description: "yo cannon is cool",
run: ({ message, args, client, handler, interaction }: any) => {
return "Pong!" // message which will be sent, always include return to don't crash
},
};
CoffeeScript
# File Name - ping.coffee
{ MessageEmbed } = require('discord.js')
module.exports = {
name: "ping"
slash: true
servers: ['814832821125775420']
description: "yo cannon is cool"
run: ({ message, args, client, handler, interaction }) ->
return "Pong!" # message which will be sent, always include return to don't crash
};

The message property isn't a discord.js Message object, it is just a small object with Guild object, Channel object, Member object and User object