0.3.7 • Published 4 years ago
slasher-revised v0.3.7
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!
Install
Install for use in a node project
npm i -s discord.js discord.js-slasherInstall the CLI tool for another language
npm i -g discord.js-slasherExample
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!
$ slasherThen we can create our bot!
const { SlasherClient } = require("discord.js-slasher");
// import { SlasherClient } from 'discord.js-slasher';
const client = new SlasherClient({ useAuth: true });
client.on("ready", () => {
console.log("Logged in as " + client.user.tag);
});
client.on("command", (ctx) => {
ctx.reply(`Howdy ${ctx.user.tag}!`);
});
client.login();Thanks
- othneildrew for the header template