A versatile Discord bot designed to elevate your server experience with a rich set of customizable features.
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.
- 🎯 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.
Runtime:
Frameworks & Libraries:
Data Storage:
Follow these steps to get your Discord bot up and running.
- Python 3.8+
- A Discord Bot Token. You can create a new application and get a token from the Discord Developer Portal.
-
Clone the repository
git clone https://github.com/Wandering-Spirit-22/Discord-Bot.git cd Discord-Bot -
Install dependencies
pip install -r requirements.txt
-
Environment setup Create a
.envfile in the root directory of your project.cp .env.example .env # .env.example is inferred from .env and common practiceOpen the newly created
.envfile and add your Discord Bot Token:DISCORD_BOT_TOKEN="YOUR_DISCORD_BOT_TOKEN_HERE"Replace
YOUR_DISCORD_BOT_TOKEN_HEREwith your actual bot token obtained from the Discord Developer Portal. -
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. -
Run the bot
python main.py
If you are hosting on a platform like Replit, the
keep_alive.pyscript will automatically start a Flask web server to ensure your bot stays online. -
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
botscope. - Choose the necessary permissions (e.g.,
Administratorfor 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.
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
The bot uses environment variables for sensitive information.
| Variable | Description | Required |
|-------------------|------------------------------------------------|----------|
| DISCORD_BOT_TOKEN | Your unique token for connecting to Discord API. | Yes |
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.
To run the bot locally:
python main.py- Set up your Python environment and install dependencies as described in the "Installation" section.
- Configure your
DISCORD_BOT_TOKENin the.envfile. - Modify
main.pyto add new commands, events, or features. - Run
python main.pyto test your changes. - Check
discord.logfor any errors or debug information.
This bot is designed to be easily deployable on platforms that support Python applications and continuous uptime.
- Replit: The
keep_alive.pyscript 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 runningmain.py, withkeep_alive.pyautomatically managing the Flask server. - Docker: For more control and scalability, consider containerizing the bot using Docker. A
Dockerfilecould 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
PM2orsystemdto keep it running.
We welcome contributions! If you have suggestions, bug reports, or want to add new features, please feel free to:
- Fork the repository.
- Create a new branch (
git checkout -b feature/AmazingFeature). - Make your changes and commit them (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
Please ensure your code adheres to Python best practices and includes appropriate comments.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built using the excellent discord.py library.
- Uses Flask for the keep-alive server.
- 🐛 Issues: GitHub Issues
⭐ Star this repo if you find it helpful!
Made with ❤️ by Wandering-Spirit-22