How ayushsharma297/discord_bot works
Project type and purpose
β’ This is a modular, full-stack Discord bot (βRajjo Gujjar πβ) built in Python.
β’ It integrates with Discord via discord.py, uses FastAPI for LLM inference, connects to a RAG server (LightRAG), and uses Lavalink for music playback. It logs to SQLite.
File structure
β’ Top-level:
β’ main.py β bot startup, cog loading, Lavalink setup
β’ methods.py β shared helpers (conversation history, token counting)
β’ requirements.txt / pyproject.toml β dependencies
β’ env.example β environment variables
β’ assets/ β media files and example screenshots
β’ cogs/ β Discord command modules (ai_chat, music, moderation, fun, info, events, roast)
β’ LLM_server/ β FastAPI app (ollama_call.py, rag_call.py, web_search.py)
β’ lavalink/ β Java Lavalink server + plugins + config
β’ token_counter/ β standalone token-counting utility
β’ utils/ β YAML system prompts and general utilities
β’ Key patterns:
β’ Cog-based architecture for commands and events
β’ Separate microservice for LLM (FastAPI)
β’ External music service (Lavalink)
β’ SQLite for logging and analytics
README for additional insights
β’ Features: AI chat, music playback, moderation, games, TTS, logging
β’ Tech stack: Python 3.10+, discord.py, aiohttp, FastAPI, LightRAG, pandas, dotenv, Lavalink, Google TTS
β’ Startup steps: Launch LLM_server (uvicorn), LightRAG, Lavalink; then run main.py