discord-with-slash
v1.0.542
Published
Make discord slash commands easy to use !
Downloads
11
Readme
This handler provides an easy to use for the brand new discord slash commands
Donate Paypal & feedback : [email protected]
Path Note 1.0.5
Type in the terminal
npm i discord-with-slash@latest
Custumize You Messages with the new send request
Now :
- You can send ephemeral messages (Hidden messages)
- You can define a custum type of the interaction response
- You can custumize your response by adding a components (buttons and that stuff)
An Example
if(!options.member.hasPermission('BAN_MEMBERS')) return options.send('You have not permission to ban member', {
ephemeral:true, components:[{
type:1,
components:[{
type:2,
label:'Invite the bot',
url: 'https://discord.gg/...',
style:5
}]
}]
});
options.guild.members.fetch(options.args.target).ban().then((banned_user) {
options.send(`${banned_user.tag} has been banned successfully ✈`);
})
Initialization
To initialise the handler just type in your script
const discord = require('discord.js');
const client = new discord.Client();
const path = require("path");
// Import the slash commands handler
const slashCommands = require('discord-with-slash');
const slashCommandHandler = new slashCommands(client, path.join(__dirname,"commands directory"), "testing guild id (Optionnal)");
client.login('your token');
Done, So now lets create our first command
First we need to create a file in the commands directory that we specified
- Slash Commands
- ping.js
Now we open the file and type the following script to create our command
module.exports = {
name: "ping",
description : "My first slash command",
execute(options) {
options.send('Pong 🏓')
}
}
You see here i declared a send function that is not availaible in the normal slash commands methods its embeded with the options and take as parameters ({content: 'The reply', interaction: options.interaction})
You can also easily create embeds
Lets Take a look
- Create a second file : name it embed.js
The directory will look something like this
- Slash Commands
- ping.js
- embed.js
Open the file and simply use the embeded send function and its done !
const { MessageEmbed } = require('discord.js');
module.exports = {
name: "embed",
description : "Sends An Embed",
execute(options) {
options.send(new MessageEmbed().setAuthor("Hey Im Using Slash Commands").setColor("RANDOM"));
}
}
We are done
We created our first slash commands within a minute, its impressive
Thank you for choosing us !
Have Fun 😉