Skip to content

All-in-one Discord bot packed with features your server needs. Play music from YouTube and Spotify, run giveaways with custom requirements, moderate your server with powerful tools, and set up reaction roles for self-service role assignment. Includes admin panel for server configuration

Notifications You must be signed in to change notification settings

HaskaZuki/MultipurposeBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Multipurpose Bot Template

A complete, easy-to-use Discord bot template built with discord.js v14. Designed for beginners and advanced users alike, featuring a modular handler, slash commands, and built-in features like Music, Moderation, Fun, Giveaways, and Reaction Roles.

Features

  • Modular Handler: Easy to maintain and expand.
  • Slash Commands: Modern Discord interactions.
  • Music System: High-quality music playback using DisTube.
  • Moderation: Kick, Ban, Purge.
  • Fun Commands: Meme, 8ball.
  • Giveaway System: Start, End, Reroll (JSON based).
  • Admin Tools: Reaction Roles, Customizable Welcome/Leave messages.
  • No Database Required: Uses simple JSON files out of the box.

Requirements

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/SimpleMultipurposeBot.git
    cd SimpleMultipurposeBot
  2. Install dependencies:

    npm install
  3. Configure the bot:

    • Rename .env.example to .env.
    • Open .env and paste your Bot Token and Client ID.
    TOKEN=your_super_secret_token_here
    CLIENT_ID=your_bot_client_id_here
    • (Optional) detailed configuration in config.js.
  4. Start the bot:

    node src/index.js

    Or for development with auto-restart:

    npm run dev

Usage Guide

Admin Features

Reaction Roles

  1. Make sure the bot has the "Manage Roles" permission and its role is ABOVE the role you want to give.
  2. Run the command:
    /reactionrole role:@RoleName emoji:🎉 description:Click the emoji to get the role!
    
  3. The bot will send an embed. Users can react to get/remove the role.

Welcome & Leave Messages

Welcome:

  • Set Channel: /setwelcome channel channel:#general
  • Set Message: /setwelcome message text:Welcome {user} to {server}! Member #{count}
  • Enable DM: /setwelcome dm enabled:true

Leave:

  • Set Channel: /setleave channel channel:#general
  • Set Message: /setleave message text:Goodbye {user}!

Variables:

  • {user} - Mentions the user (or tag).
  • {server} - Server name.
  • {count} - Current member count.

Adding New Commands

  1. Go to src/commands.

  2. Create a new folder (category) or use an existing one.

  3. Create a new .js file (e.g., ping.js).

  4. Use this template:

    const { SlashCommandBuilder } = require('discord.js');
    
    module.exports = {
        data: new SlashCommandBuilder()
            .setName('commandname')
            .setDescription('Description of command'),
        async execute(interaction, client) {
            await interaction.reply('Hello World!');
        },
    };
  5. Restart the bot! The handler automatically loads and registers the new command.

Switching to a Real Database (MongoDB)

Currently, the bot uses JSON files in the /data folder for storage. This is great for small bots but can corrupt if multiple writes happen at once. For larger bots, use MongoDB.

Steps to Migrate:

  1. Install Mongoose:

    npm install mongoose
  2. Connect to MongoDB:

    • In src/index.js, add this before client.login():
      const mongoose = require('mongoose');
      mongoose.connect(process.env.MONGO_URI)
        .then(() => console.log('Connected to MongoDB'))
        .catch(err => console.error(err));
    • Add MONGO_URI to your .env file.
  3. Create Schemas:

    • Create a src/models folder.
    • Example Giveaway.js:
      const mongoose = require('mongoose');
      module.exports = mongoose.model('Giveaway', new mongoose.Schema({
          messageId: String,
          prize: String,
          // ... helper fields
      }));
  4. Update Commands:

    • Instead of reading/writing JSON files using fs, use the Mongoose models.
    • Example replacement in start.js:
      const Giveaway = require('../../models/Giveaway');
      // ...
      await Giveaway.create({ messageId: message.id, ... });

Contributing

Feel free to fork this project and submit pull requests!

License

This project is licensed under the MIT License.

About

All-in-one Discord bot packed with features your server needs. Play music from YouTube and Spotify, run giveaways with custom requirements, moderate your server with powerful tools, and set up reaction roles for self-service role assignment. Includes admin panel for server configuration

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published