Creating a Command
For experienced developers. Current DiscordJS version: 14.9.0
- Open
LuxuDiscordBot/server/commands - Create a new file for your command (e.g.
example.js) - Follow this structure:
module.exports = {
data: {
name: "command-name",
description: "Command description",
options: [
{
name: "example-option",
description: "Option description",
type: ApplicationCommandOptionType.String,
required: true,
},
],
},
async execute(client, interaction) {
const hasPerm = await client.checkPermission(interaction, this.data.name);
if (!hasPerm) return;
// your logic here
interaction.reply({
content: `${client.Locale("UnBanPlayerFailed")}`,
ephemeral: true,
});
const hasSubcommands = false;
client.utils?.log.info(interaction, hasSubcommands);
} catch (e) {
console.error("Error banning player", e);
}
},
};- Save the file and restart the resource.