Frighteningly simple slash commands
Documentation »
Report Bug
·
Request Feature
Slasher is a framework to simplify the creation of Discord bots.
Forget about SlashCommandBuilder
and REST
. Slasher takes care of all of it for you, and provides a simple, easy-to-use interface to build your bot using slash commands.
Even if you're not using discord.js to build your bot, you can still make use of the handy CLI tool to make adding slash commands painless!
If you are using Slasher for the first time, please see the Getting Started guide.
If you are migrating an existing bot, please see the Slasher Migration guide.
Install for use in a node project
npm i -s discord.js discord.js-slasher
Install the CLI tool for another language
npm i -g discord.js-slasher
First we create our commands.json
definition file:
{
"test": {
"description": "My first command on Discord!"
}
}
Then run the slasher
utility and follow the prompts to upload it to Discord!
$ npx slasher
Then we can create our bot!
const { Events } = require("discord.js");
const { SlasherClient, SlasherEvents } = require("discord.js-slasher");
// alternatively use import statements
const client = new SlasherClient();
client.on(Events.ClientReady, () => {
console.log("Logged in as " + client.user.tag);
});
client.on(SlasherEvents.CommandCreate, (ctx) => {
ctx.reply(`Howdy ${ctx.user.tag}!`);
});
client.login();