## Introduction

WDiscordBot is an open-source bot designed for customization. This guide explains how to safely modify its features while preserving critical functionality.

## Understanding the Cog System

The cog system allows modular bot functionality by separating commands, event listeners, and utilities into isolated components.

## Directory Structure and Core Components

    /project-root
    │
    ├──cogs
    ├── ai.py
    ├── application.py
    ├── automod.py
    ├── cog2.py
    ├── cogupdate.py
    ├── contribute.py
    ├── core.py
    ├── debug2.py
    ├── fun.py
    ├── howtohelp.py
    ├── issues.py
    ├── mod.py
    ├── rolemgt.py
    ├── roleplay.py
    |── rule34.py
    │
    ├── bot.py               // Main bot loader
            (ignore the rest thats just the readme and the website code)

## Guidelines for Modding Cogs

- Use version control to track changes.
- Avoid modifying core files; instead, extend functionality.
- Follow coding conventions for consistency.
- Implement robust error handling.
- Keep modifications modular for easier debugging.

## Files to Avoid Editing

Do not edit the following files, as they are critical:

- `cogs/core.py`
- `cogs/debug.py`
- `cogs/debug2.py`
- `cogs/cog2.py`
- `cogs/cogupdate.py`

## Creating and Integrating New Cogs

To add new features, create a new cog file, following this template:

    // File: cogs/demo.py

    from discord.ext import commands

    class CustomMod(commands.Cog):
        def __init__(self, bot):
            self.bot = bot

        @commands.command(name="hello")
        async def hello_command(self, ctx):
            """Responds with a greeting."""
            await ctx.send("Hello, world!")

    def setup(bot):
        bot.add_cog(CustomMod(bot))

## Testing and Debugging Your Mods

- Test locally before deploying.
- Write unit and integration tests.
- Monitor logs to detect errors.

## Contributing

We welcome contributions to WDiscordBot! Please follow these steps:

- Fork the Repository: Click on the "Fork" button in the GitHub repository to create your copy.
- Clone Your Fork: Use `git clone <https://github.com/pancakes-proxy/wdiscordbot.git>` to download your fork locally.
- Create a Branch: Always create a new branch for your changes, using a clear and descriptive name.
- Implement Your Changes: Follow the project's coding guidelines and update documentation where necessary. Don't forget to add tests for any new functionality.
- Submit a Pull Request: Once your changes pass local testing, submit a pull request to the main repository with a detailed explanation of your modifications.
- Participate in Code Review: Engage in discussions, address feedback, and adjust your changes as needed.
- Stay Synchronized: Regularly pull updates from the upstream repository to keep your fork up-to-date and avoid merge conflicts.

For questions or further guidance, join our Discord community or refer to the repository's issue tracker.

## Conclusion

Follow these best practices to keep WDiscordBot stable, mod-friendly, and open for contributions. By avoiding modifications to core files, using modular design, and adhering to contribution guidelines, you'll help foster a vibrant, collaborative community.