Ping command example
Welcome to Commands & Contexts section!
First you must setup you SLCommands:
Easy Setup & Options ObjectThen create a "commands" folder where you can create a "ping.js" or "ping.ts" file.
Do not forget: onExecute
or addSubCommand
must be the last functions, so the command is properly registered.
const { ChatInputCommand } = require('sl-commands')
new ChatInputCommand()
// The command name (required)
.setName('ping')
// The command description (required)
.setDescription('Shows my ping')
// Only register for the testing servers
.setTestOnly(true)
// Executed whenever the command is used
.onExecute(({ client, interaction }) => {
// Replying the slash command interaction
interaction.reply(`API's ping is ${client.ws.ping}`)
})
Last updated