Code Monkey home page Code Monkey logo

discord-music-bot's Introduction

Pro Handler Template (Riffy Music Bot)

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
  • Music commands (using riffy)

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/advanced-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.

Lavalink

If you want to use lavalink, then put your lavalink host in config file.

nodes: [
        {
            host: "localhost",
            port: 2333,
            password: "youshallnotpass",
            secure: false
        }
    ]

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.

discord-music-bot's People

Contributors

flameface avatar

Stargazers

AstralStore avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.