/discord-pro-handler

The pro discord bot handler using discord.js for pro bots with millions of features.

Primary LanguageJavaScriptMIT LicenseMIT

Pro Handler Template

I made this handler template keeping in mind that you know the basics of js and djs, so I won't be explaining the basics of js and djs in this readme.

Features

  • Shard support with shard stats commands
  • Easy to interact
  • Reload commands, slash commands, events, and more without restarting the bot
  • Developer commands
  • Database support (using mongoose)
  • Prefix + Slash commands support
  • Error handling & Permission handling
  • Customizable

Requirements

  • Node.js v16 or higher
  • Built using discord.js v14
  • MongoDB database (optional)

Installation

1. Clone the repository

git clone https://github.com/flam3face/discord-pro-handler.git

2. Install the dependencies

npm install

3. Configure the bot

In config file, fill in the required fields.

4. Run the bot

npm start

Shard

If you want to use shards, then make shard true in config file.

shard: true

Note: Your bot should be in more than 2500 servers to use shards.

Database (optional)

If you want to use database, then make database true in config file.

database: true

Note: You need to have a MongoDB database to use the database and you need to put mongodb url in config file.

Command Config

1. Permissions

You can set the permissions for the command by adding clientPermissions and userPermissions in the command file.

module.exports = {
    name: "ping",
    description: "Get the bot's ping",
    clientPermissions: ["SendMessages"], // Permissions that the bot needs to run the command
    userPermissions: ["SendMessages"], // Permissions that the user needs to run the command
    run: async (client, message, args) => {
        message.channel.send(`Pong! ${client.ws.ping}ms`);
    }
}

2. Developer Only

You can make the command developer only by adding developerOnly in the command file.

module.exports = {
    name: "ping",
    description: "Get the bot's ping",
    developerOnly: true, // If this is true, then only the bot developers can run this command
    run: async (client, message, args) => {
        message.channel.send(`Pong! ${client.ws.ping}ms`);
    }
}

3. Guild Only

You can make the command guild only by adding guildOnly in the command file.

module.exports = {
    name: "ping",
    description: "Get the bot's ping",
    guildOnly: true, // If this is true, then the command can only be used in guilds
    run: async (client, message, args) => {
        message.channel.send(`Pong! ${client.ws.ping}ms`);
    }
}

Controls

1. Reload

You can reload commands & slash commands without restarting the bot.

const { ApplicationCommandOptionType } = require("discord.js");
const { reloadCommands } = require("../../functions/control");

module.exports = {
    name: "reloadcommand",
    description: "Reloads a command",
    options: [
        {
            name: "command",
            description: "The command to reload",
            type: ApplicationCommandOptionType.String,
            required: true
        }
    ],

    run: async (client, interaction, args) => {
        const command = interaction.options.getString("command");
        const output = await reloadCommands(command);

        interaction.reply(output);
    }
}

Contact

If you have any questions or suggestions, then you can join our support server and ask there.

License

This project is licensed under the MIT License.