discord-scmd v1.0.1
discord-scmd
A easy way to manage Discord slash commands for discord.js
Getting help
Feel free to send me an E-Mail but I personally recommend you to dm me via Discord. Otherwise feel free to join my Discord server. Love you
Install
npm i discord-scmd
Useage
1. Setup
const Discord = require("discord.js")
const client = new Discord.Client()
const Scmd = require("discord-scmd")
const scmd = new Scmd(client)
2. Create a command
// Create the choices
const ban = new scmd.Choice("Ban", "Ban a Member")
const kick = new scmd.Choice("Kick", "Kick a Member")
// Create an option
const option = new scmd.Option("STRING", "command", "Get more info about a cmd", true, [
ban,
kick
])
// Create a guild command
scmd.guild("guild id").createCommand("help", "Get some help", [option], true)
// Create a global command
scmd.global().createCommand("help", "Get some help", [option], true)
Parameter
scmd.global().createCommand()
/ scmd.guild(...).createCommand()
| Name | type | Description | Required | Default |
| ------------- |-------------| ----- | ------- | ------- |
| name | string | 1-32 lowercase character name matching ^\w-{1,32}$ | Yes | - |
| description | string | 1-100 character description | Yes | - |
| options | array | The parameters for the command | Yes | []
|
| default_permission | boolean | Whether the command is enabled by default when the bot is added to a guild | No | true
|
scmd.global().getSingleCommand()
/ scmd.guild(...).getSingleCommand()
| Name | type | Description | Required |
| ------------- |-------------| ----- | ------- |
| command | string | The name or id of the command | Yes |
scmd.global().editCommand()
/ scmd.guild(...).editCommand()
| Name | type | Description | Required |
| ------------- |-------------| ----- | ------- |
| command | string | The name or id of the command | Yes |
| name | string | 1-32 lowercase character name matching ^\w-{1,32}$ | No |
| description | string | 1-100 character description | No |
| options | array | The parameters for the command | No |
| default_permission | boolean | Whether the command is enabled by default when the bot is added to a guild | No |
scmd.global().deleteCommand()
/ scmd.guild(...).deleteCommand()
| Name | type | Description | Required |
| ------------- |-------------| ----- | ------- |
| command | string | The name or id of the command | Yes |