npm version


A small library for making slash commands easy without using gateways or discord.js. Just the raw Discord Api.


This project requires NodeJS (version 8 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.

$ npm -v && node -v

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.


BEFORE YOU INSTALL: please read the prerequisites

To install and set up the library, run:

$ npm install discord-easy-slash

Or if you prefer using Yarn:

$ yarn add --dev discord-easy-slash


First, Start by importing the library

var client = require('discord-easy-slash');

Then, Provide all of your bot’s details

client.TOKEN = '<TOKEN>'
client.GUILD_ID = 'GUILD_ID' // (you still need this, as you have to have a testing server)

Making a command:

client.command('help', 1, 'help command?', null)

The command function takes 4 arguments, Name (Of the command), Type (Of the command), Description (Of the command), and Options, any options that the command takes.

For types:

or look at this page by discord.

For options:

They look like this:

[ { "name": "nameofoption", "description": "descriptionofoption", "type": 4, "required": true, } ]

It takes an array, with all the options for the command. Because of this, you can have multiple options for a single command.

For types of objects: or look at this page by discord.

Main Event Listener:

client.on('slash_event', (command, data, res, type) => {
  console.log('slash event!')

The event listener only has 1 event to listen for as of 1.0.7: ‘slash_event'(s).

slash_event takes 4 arguments, command, data, res, and type.

command is the name of the slash command that was sent.

data is the data that was sent with the command.

res is the response object that you can use to send a message back to the user.

and type is the type of the command.

client.on('slash_event', (command, data, res, type) => {
if(command == 'help'){
    client.reply(res, 'Help command?', null)
    }else {
        client.reply(res, 'Cound not find command..', null)

client.reply takes 3 arguments, res, which is mandatory because it is used to send the message, message, which is the message to send, and embeds, which is an array of embeds for the command to send.

For embeds:

[ { "title": "title", "description": "description", "color": "color", "fields": [ { "name": "name", "value": "value", "inline": true }, { "name": "name", "value": "value", "inline": true } ] } ]

Making our bot search for interactions/logging-in/turning it on:


Telling Discord where to look for our bot:

Inside the INTERACTION ENDPOINTS URL box, put in the url of the server your bot is running on, with the endpoint “/event”.

For example: https://server_address/event


Serving the app

$ npm start


You can contribute to the project by making a pull request on GitHub.



Built With


See also the list of contributors who participated in this project.


MIT License © Amukh1


View Github