This repository has been archived by the owner on Feb 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Client
xlyr.on edited this page Jan 23, 2021
·
17 revisions
new Slash.Client(discordClient, config);
Parameter | Type | Description | required |
---|---|---|---|
client | Discord Client | a discord client | true |
config | object | bot settings | true |
type: Discord Client
type: object
returns Promise <Command>
Parameter | Type | Description | required |
---|---|---|---|
name | string | name of command | true |
returns Promise <...command, securityCheck>
Parameter | Type | Description | required |
---|---|---|---|
interaction | Interaction | slash interaction object | true |
index.js
const config = {
"commands": {
"directory": "/path/to/commands", //path to commands folder
"subcategories": "false" //if commands are divided by folders change to "true"
},
"bot": {
"token": "bot_token_here"
}
}
const Discord = require('discord.js');
const client = new Discord.Client();
const Slash = require('da-slash');
const slash = new Slash.Client(client, config);
client.once('ready', () => {
//updates Commands
slash.postCommands();
})
//emitted when a slash command is detected
client.ws.on('INTERACTION_CREATE', async request => {
const interaction = new Slash.Interaction(client, request);
//finds the matching slash command and executes it
slash.matchCommand(interaction);
})
client.login(config.bot.token);