Getting started

Installation

Use the package manager npm to install @mxgnus/slashcommands.js.

npm i @mxgnus/slashcommands.js

Create a new slashcommand

const {
   GuildSlashCommand,
   Slashcommand,
   Slash,
} = require('@mxgnus/slashcommands.js');
new Slash(bot /* your discord.js client */); // initialize the slash command

// create a guild slashcommand
new GuildSlashCommand()
   .setGuildId('your guild id')
   .setName('commandname')
   .setDescription('command description')
   .register();

// create a global slashcommand
new Slashcommand()
   .setName('commandname')
   .setDescription('command description')
   .register();

Create a new slashcommand with options

Create a new slashcommand with options and choices

Fetch slashcommands

Delete slashcommands

Delete all slashcommands

Respond to a slashcommand

Need help?

WARNING

Discord takes a lot of time to create or update a slashcommand. So be patient if you add one.

Guild slashcommands should update directly

Also you need to invite your bot with the application.commands permission:

https://discord.com/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=0scope=applications.commands%20bot

License

ISC

Last updated