Required permissions
You may want your commands to only be ran by users who have specific Discord permissions. This is often useful for administration commands. Using NYXBCommands you can easily specify what Discord permissions users need to run the command:
TypeScript
import { PermissionFlagsBits } from 'discord.js'
import { CommandObject, CommandType, CooldownTypes } from '@nyxb/commands'
export default {
description: 'Ping pong command',
type: CommandType.BOTH,
permissions: [PermissionFlagsBits.Administrator],
callback: () => {
return {
content: 'Pong!',
}
},
} as CommandObject
CommandsCooldownsYou can use command cooldowns to ensure your commands are only ran every so often. Each cooldown type requires a string for it's duration and duration type (seconds, minutes, etc)CommandsSlash commandsSlash commands are a new system for commands within Discord bots. NYXBCommands aims to help developers implement slash commands in the easiest way possible.
Here is a basic ping pong slash command example: