README
slash_commands.js
slash_commands.js is a free easy to use slash command package for discords.js
If you find any bugs, contact me
Installation
Use the package manager npm to install slash_commands.js.
npm i slash_commands.js
Create Example
const slash = require("slash_commands.js") //define the package
//create a slash command option
const helpcommandOption = new slash.slashOption()
.setName("name")
.setDescription("Enter your name")
.setType("string")
.setRequired(false)
//create a command
const helpCommand = new slash.slashCommand(client /*your discord client*/)
.setName("help")
.setDescription("The help command.")
.addOption(helpcommandOption) //add the option declared on the top
Respond Example
slash.onExecute(client, (message)=>{
if(message.content == "help"){ // test if the command executed is the help command
message.reply({content:"Hi", ephemeral:false}).then(msg=>{ //send a response (if you write true instead of false only you can see the message)
setTimeout(()=>{
msg.edit({content:"bye!"}) //edit the message
},5000)
})
}
})