CDHandler
  • CDHandler Documentation
  • Links
    • NPM Page
    • GitHub Repository
    • Example Bots using CDHandler
    • Discord Server
  • Development
    • Changelog
    • Contribute
    • Issues and Feature Requests
  • Using CDHandler
    • Installation
    • Main File
    • Commands
      • Examples
      • Slash Commands
    • Intellisense
    • Events
    • Features
    • Prefixes
  • Other Packages
    • CDGen
    • CDColours
    • CDCommands
Powered by GitBook
On this page
  • Slash Command Options
  • Examples

Was this helpful?

  1. Using CDHandler
  2. Commands

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

// 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
   },
};
// 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
   },
};
# 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

PreviousExamplesNextIntellisense

Last updated 4 years ago

Was this helpful?