-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commands
Ayfri edited this page Feb 12, 2021
·
10 revisions
Commands are the principal objects for this library, you can see here how to create a command and the defaults value :
const {Command} = require('advanced-command-handler');
module.exports = new Command(
{
name: '',
// Optionnals :
description: '',
usage: '',
category: '',
tags: [],
aliases: [],
userPermissions: [],
clientPermissions: ['SEND_MESSAGES'],
channels: [],
cooldown: 0,
},
async (handler, message, args) => {
// Code goes here.
}
);
And you can see a "complete" example of what a command could look like :
const {Command, Tag} = require('advanced-command-handler');
module.exports = new Command(
{
name: 'kick',
description: 'Kicks the person you want.',
usage: 'kick <user> [reason]',
category: 'moderation',
tags: [Tag.guildOnly],
aliases: ['k', 'eject'],
userPermissions: ['KICK_MEMBERS'],
clientPermissions: ['KICK_MEMBERS'],
cooldown: 10,
},
async (handler, message, args) => {
// Code goes here.
}
);
Note: Command function car get any argument you put with a custom message event.
You have to put the command into a category folder into your commands folder like in the examples & tests.
This will also automatically set the category
property of the command.
The official Discord support server is there.