Skip to content

Repository files navigation

🤖 Discord Bot

A versatile Discord bot designed to elevate your server experience with a rich set of customizable features.

📖 Overview

This project provides a robust and customizable Discord bot crafted to enrich any Discord server. Built with Python and the discord.py library, it offers a wide array of functionalities ranging from essential moderation tools to engaging fun commands, utility features, and a dynamic level and experience system. Its design emphasizes ease of setup and extensive customization, making it an ideal solution for server administrators looking to enhance community interaction and management.

✨ Features

  • 🎯 Moderation Commands: Tools for managing server members and maintaining order (e.g., kick, ban, mute).
  • 🎲 Fun & Interactive Commands: Engage your community with various entertaining commands and games.
  • 🛠️ Utility Tools: Useful commands for retrieving server information, user profiles, and more.
  • 📈 Level & Experience System: A dynamic system for users to gain experience, level up, and earn rewards, enhancing engagement.
  • 💰 Currency System: Integrated currency management tied to user activity and rewards.
  • ⚙️ Customizable Interactions: Configurable buttons and roles for interactive experiences (e.g., self-assignable roles, reaction roles).
  • 🔒 Role-Based Permissions: Ensures commands are only accessible to users with appropriate permissions.
  • 🔄 Keep-Alive Functionality: Includes a web server (Flask) to ensure the bot remains online, particularly useful for cloud hosting environments like Replit.

🛠️ Tech Stack

Runtime:

Python

Frameworks & Libraries:

discord.py

Flask

Data Storage:

JSON

🚀 Quick Start

Follow these steps to get your Discord bot up and running.

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/Wandering-Spirit-22/Discord-Bot.git
    cd Discord-Bot
  2. Install dependencies

    pip install -r requirements.txt
  3. Environment setup Create a .env file in the root directory of your project.

    cp .env.example .env # .env.example is inferred from .env and common practice

    Open the newly created .env file and add your Discord Bot Token:

    DISCORD_BOT_TOKEN="YOUR_DISCORD_BOT_TOKEN_HERE"
    

    Replace YOUR_DISCORD_BOT_TOKEN_HERE with your actual bot token obtained from the Discord Developer Portal.

  4. Database setup The bot uses JSON files for data storage. These files (currency.json, button_choices.json, role_choices.json) will be automatically created or updated as needed by the bot. Ensure they exist, or the bot will create empty ones on first run.

  5. Run the bot

    python main.py

    If you are hosting on a platform like Replit, the keep_alive.py script will automatically start a Flask web server to ensure your bot stays online.

  6. Add the bot to your Discord server Once your bot is running, you'll need to invite it to your server.

    • Go to the Discord Developer Portal.
    • Select your bot application.
    • Navigate to OAuth2 -> URL Generator.
    • Select bot scope.
    • Choose the necessary permissions (e.g., Administrator for full functionality, or specific permissions based on commands).
    • Copy the generated URL and paste it into your browser to invite the bot to your server.

📁 Project Structure

Discord-Bot/
├── .env                 # Environment variables for bot token
├── .gitignore           # Specifies intentionally untracked files to ignore
├── LICENSE              # Project license (MIT)
├── main.py              # Main bot logic, commands, events, and setup
├── keep_alive.py        # Flask server to keep the bot alive for continuous hosting
├── requirements.txt     # Python dependencies required for the bot
├── currency.json        # Stores data for the bot's currency system
├── button_choices.json  # Configuration for interactive buttons and choices
├── role_choices.json    # Configuration for self-assignable roles
└── discord.log          # Log file for bot activities and errors

⚙️ Configuration

Environment Variables

The bot uses environment variables for sensitive information.

| Variable | Description | Required |

|-------------------|------------------------------------------------|----------|

| DISCORD_BOT_TOKEN | Your unique token for connecting to Discord API. | Yes |

Configuration Files

The bot leverages JSON files for persistent data and dynamic configurations:

  • currency.json: Manages user balances and economic data within the bot.
  • button_choices.json: Defines interactive buttons, their labels, and associated actions.
  • role_choices.json: Configures roles that users can self-assign or interact with via commands.

These files are automatically managed by the bot; however, advanced users can directly edit them for custom configurations.

🔧 Development

Available Scripts

To run the bot locally:

python main.py

Development Workflow

  1. Set up your Python environment and install dependencies as described in the "Installation" section.
  2. Configure your DISCORD_BOT_TOKEN in the .env file.
  3. Modify main.py to add new commands, events, or features.
  4. Run python main.py to test your changes.
  5. Check discord.log for any errors or debug information.

🚀 Deployment

This bot is designed to be easily deployable on platforms that support Python applications and continuous uptime.

Recommended Hosting

  • Replit: The keep_alive.py script is specifically designed to keep the bot active on platforms like Replit, which might otherwise shut down inactive processes. Deploying to Replit usually involves cloning the repository and running main.py, with keep_alive.py automatically managing the Flask server.
  • Docker: For more control and scalability, consider containerizing the bot using Docker. A Dockerfile could be added for easy deployment to any Docker-compatible hosting.
  • Virtual Private Server (VPS): For dedicated hosting, you can run the bot script directly on a VPS, optionally using process managers like PM2 or systemd to keep it running.

🤝 Contributing

We welcome contributions! If you have suggestions, bug reports, or want to add new features, please feel free to:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/AmazingFeature).
  3. Make your changes and commit them (git commit -m 'Add some AmazingFeature').
  4. Push to the branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

Please ensure your code adheres to Python best practices and includes appropriate comments.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built using the excellent discord.py library.
  • Uses Flask for the keep-alive server.

📞 Support & Contact


⭐ Star this repo if you find it helpful!

Made with ❤️ by Wandering-Spirit-22

About

A custom Discord bot built to enhance your server experience. This bot includes a variety of features such as moderation, fun commands, utility tools, level, experience system and more. Fully customizable and easy to set up.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages