Structure

Basic structure of powerdiscord

The system works in a modular way; for example, you can organize event files within folders, within other folders, to adapt to any work style or order. Similarly, with slash commands, you can organize them into subfolders.

The structure of the code must be as follows for correct operation.

Events Structure
module.exports = {
    name: "interactionCreate", // => Name of discord event. // * Required
    run: async (client) => { // * Required

        // Your code here.

    }};
SlashCommands Structure
const { ApplicationCommandOptionType } = require("discord.js");

module.exports = {
    name: "example", // * Required
    description: "Example command.", // * Required
    userPerms: ["Administrator"], // - Optional
    botPerms: ["Administrator"], // - Optional
    options: [ // - Optional
        {
            name: "option",
            description: "Select an option",
            type: ApplicationCommandOptionType.String,
            required: true,
            choices: [
                { name: "One", value: "one-option" },
                { name: "Two", value: "two-option" },
            ]
        },
    ],

    run: async (client, interaction) => {

        await interaction.reply("Hello World");
        
    }};
API Structure
/*
    Type: GET
    Do not delete this section
*/

module.exports = (req, res) => {

    return res.status(200).send("Hello World!")
}

In the case of the API structure, it is important to always keep that top comment, this tells the system what type of request to accept, it is also possible to set it as ALL if it is not necessary to filter them by type.

Last updated