Local branch had diverged from origin/master (sibling commits on the same base). Rewrote local history linearly on top of origin/master, folding in all local content: exa/hot-platform discovery hunters, leaks ledger, nightly sweep orchestrator, updated .gitignore and skill docs, plus the latest hunt output and vault state. Remote-only files (vault keys, channel scripts) were restored rather than dropped, so the resulting tree is a full union of both sides.
1 line
3.9 KiB
JSON
1 line
3.9 KiB
JSON
{"repo": "ahmad-masud/chirag", "files": {"README.md": {"5e34cfa45b3ea8f2027b181b4939aec9b77b3750": {"t": 1786068578.7379453, "n": 3765, "h": "659074820e22c7ab", "c": "# Chirag Discord Bot\n\nAn AI-powered Discord bot built with Python, `discord.py`, and multiple model providers with automatic fallback.\n\nThe bot is prompted to roleplay as **Chirag Gupta** from the *Diary of a Wimpy Kid* universe. It keeps a persistent per-server memory, uses the last 20 messages as context, and still focuses its reply on the latest message in the conversation.\n\n## Tech Stack\n* **Python 3.12+**\n* **discord.py** - For interacting with the Discord API.\n* **google-genai** - For Gemini responses.\n* **openai** - For DeepSeek, Groq, and OpenRouter responses.\n* **Flask** - A lightweight web server used to keep the bot alive on cloud hosts.\n* **JSON file storage** - For persistent server memory.\n\n## Project Structure\n* `main.py`: Connects to Discord, builds the 20-message conversation context, and routes replies.\n* `bot_commands.py`: Shared command handlers and embed builders for mention-based control flow.\n* `bot_state.py`: Small runtime state container for cooldowns, uptime, and server modes.\n* `ai_handler.py`: Provider fallback, persona assembly, and server memory integration.\n* `conversation.py`: Builds the final transcript sent to the model.\n* `memory_store.py`: Persistent per-server memory backed by a local JSON file.\n* `persona.py`: Static roleplay prompt.\n* `keep_alive.py`: Runs a background Flask server so cloud services don't put the bot to sleep.\n* `tests/`: Unit tests for the helpers and response flow.\n* `requirements.txt`: Project dependencies.\n* `.env`: (Not uploaded to Git) Stores private API keys.\n\n## Local Setup\n\n1. **Clone the repository:**\n ```bash\n git clone https://github.com/ahmad-masud/chirag.git\n cd chirag\n ```\n\n2. **Install dependencies:**\n ```bash\n pip install -r requirements.txt\n ```\n\n3. **Set up environment variables:**\n Create a file named `.env` in the root directory and add your API keys:\n ```env\n DISCORD_TOKEN=your_discord_bot_token_here\n GEMINI_API_KEY=your_google_gemini_api_key_here\n DEEPSEEK_API_KEY=your_deepseek_api_key_here\n GROQ_API_KEY=your_groq_api_key_here\n OPENROUTER_API_KEY=your_openrouter_api_key_here\n ```\n\n4. **Run the bot:**\n ```bash\n python main.py\n ```\n\n## Cloud Deployment (24/7 Uptime)\nThis bot is designed to be hosted for free using **Render** and **UptimeRobot**. \n\n1. Push this code to a private GitHub repository.\n2. Create a **Web Service** on Render linked to your repository.\n3. Use the following settings on Render:\n * **Build Command:** `pip install -r requirements.txt`\n * **Start Command:** `gunicorn keep_alive:app & python main.py`\n4. Add your `DISCORD_TOKEN`, `GEMINI_API_KEY`, and any other provider API keys you want enabled on Render.\n5. Copy the provided Render URL and create an HTTP monitor on UptimeRobot to ping it every 5 minutes. This prevents Render's free tier from putting the bot to sleep.\n\n## Usage\nOnce the bot is online and in your server, you can `@mention` it to get a direct response. It also watches regular chat and can respond when the name \"chirag\" appears, unless shutup mode is enabled.\n\nServer memory commands:\n* `@Chirag add_context <text>` - store a persistent fact for that server\n* `@Chirag remove_context <number>` - remove a saved fact\n* `@Chirag clear_context` - clear all saved facts for that server\n* `@Chirag context` - show saved facts\n* `@Chirag stats` - show uptime, latency, provider usage, and mode state\n* `@Chirag shutup` / `@Chirag startup` - disable or re-enable automatic replies\n\n## Testing\nRun the automated test suite locally with:\n```bash\npython -m unittest discover -s tests -p \"test_*.py\"\n```\n\nThe repository also includes a GitHub Actions workflow in [.github/workflows/ci.yml](.github/workflows/ci.yml) that runs the same command on every push and pull request."}}}} |