Required Permissions
You may want your bot commands to be ran by users in a Discord Server with the required Server permissions or roles.
Permissions
With that, let's add this option to our device
command:
const { NoCliCommandType } = require("nocli-handler.js");
const { PermissionFlagsBits } = require("discord.js")
/**
* @type {import("nocli-handler.js").ICommand}
*/
const Command = {
description: "Asks what device you are using",
type: NoCliCommandType.Slash,
expectedArgs: '<device>',
permissions: [PermissionFlagsBits.Administrator],
minArgs: 1,
maxArgs: 1,
autocomplete: (interaction, command, args) => {
return ["Desktop", "Laptop", "Phone", "Tablet"]
},
callback: ({ client, interaction, args, text }) => {
return `You chose ${args.join(' ')}`;
}
}
module.exports = Command;
End Result
Last updated