Note: This documentation is yet to be updated for RickBot 1.2.1.
RickBot is an advanced framework designed for building complex (or simple) Discord bots quickly and efficiently using discord.py.
- Introduction
- Features
- Installation
- Configuration
- Project Structure
- Usage
- Creating Custom Cogs
- Database Integration
- Troubleshooting
- Contributing
RickBot is designed to help developers build scalable and maintainable Discord bots with ease. Using the discord.py library, RickBot provides a structured and modular approach to bot development, making it simple to extend functionality as your bot grows.
- Modular Design: Easily add or remove features through cogs.
- Database Integration: MongoDB is supported for robust and flexible data storage.
- Highly Configurable: Extensive options for fine-tuning bot behavior.
- Extensible: Quickly add custom commands and events.
Ensure the following software is installed on your system:
- Python 3.10+: Download Python
- pip: Python package installer (typically included with Python)
- git: Download Git
- MongoDB: MongoDB Setup Guide | Free MongoDB Deployment
-
Clone the Repository:
git clone https://github.com/zachlagden/rickbot
-
Navigate to the Project Directory:
cd rickbot
-
Install Required Packages:
pip install -r requirements.txt
config.json
: Holds the core bot configuration.customconfig.json
: Optional file for additional custom settings.
Note:
config.py
is not a configuration file itself. It ensures thatconfig.json
andcustomconfig.json
are properly loaded into the project.
{
"mode": "dev",
"devs": [123456789],
"bot": {
"token": "BOT TOKEN",
"prefix": "!",
"status": {
"type": "playing",
"message": "a game"
}
},
"behaviour": {
"continue_to_load_cogs_after_failure": false
},
"mongo": {
"uri": "mongodb uri",
"bot_specific_db": "bot"
}
}
app.py
: Main entry point for running the bot.cogs/
: Directory for bot functionality modules (cogs).helpers/
: Utility functions and helper scripts.rickbot/
: Core framework files for RickBot.config.json
: Primary configuration file.customconfig.json
: Optional file for additional custom settings.
To start the bot, run the following command:
python app.py
Cogs are modular extensions used to add functionality to your bot. They should be placed in the cogs/<category>/
directory, where additional folders separate cog categories. To maintain optimal organization, RickBot encourages using one cog per command.
import discord
from discord.ext import commands
class ExampleCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def hello(self, ctx):
await ctx.send("Hello, world!")
def setup(bot):
bot.add_cog(ExampleCog(bot))
RickBot integrates with MongoDB for data storage. Ensure your MongoDB URI is correctly set in the config.json
file. The db.py
file serves as a convenient base for managing database connections and collections, but feel free to customize it to meet your specific requirements.
from pymongo import MongoClient
from config import CONFIG
client = MongoClient(CONFIG['mongo']['uri'])
db = client['rickbot']
collection = db['example']
- Installation Issues: Ensure all prerequisites are correctly installed, and verify your environment variables.
- Bot Not Responding: Confirm that the bot token is valid and the bot has appropriate permissions.
- Database Errors: Verify your MongoDB URI and ensure that MongoDB is running.
Contributions are welcome! Whether you're fixing bugs, adding features, or improving documentation, your contributions help improve RickBot.
-
Fork the Repository: Click the "Fork" button on the repository page.
-
Clone Your Fork: Clone the repository to your local machine:
git clone https://github.com/Lagden-Development/rickbot.git
-
Create a Branch: Always create a new branch for your changes:
git checkout -b feature/your-feature-name
-
Commit Messages: Write clear and concise commit messages. Use this format:
[Component] Brief description of changes
Example:
[Cog] Added command to fetch weather updates
-
Code Style: Maintain the existing code style. Use consistent indentation and document complex logic with comments.
-
Documentation: Update relevant documentation (including the README) to reflect your changes. Add docstrings where appropriate.
-
Run Tests: Test your changes to ensure they work as expected.
-
Lint Your Code: Run a linter to check for code style issues:
flake8 your_file.py
-
Push to Your Fork:
git push origin feature/your-feature-name
-
Create a Pull Request: Open a pull request on the original repository with a detailed description of your changes and any issues it addresses.
- Bug Fixes: Reference the issue number in your commit messages and pull request description.
- New Features: Clearly explain the new feature and its value.
- Documentation: Ensure all new features are documented appropriately.
If you need help or have questions, we’re here to assist you. However, please keep the following in mind:
- RickBot Issues: We provide support for any bugs, feature requests, or general questions related to RickBot. Join our Discord Server or get in contact via Email.
- discord.py Issues: For issues related specifically to discord.py, please refer to the discord.py documentation or join the discord.py support server.
- Check Existing Issues: Search the issue tracker for similar problems before posting a new issue.
- Create a New Issue: If no solution is found, create a new issue and provide as much detail as possible, including steps to reproduce and any error messages.
- Submit a Pull Request: If you have a solution for the issue, feel free to submit a pull request.
This project is licensed under a non-commercial open-source license. View the full license here.