How xynnpg/discordai works
This is a Discord AI chat bot with a companion Flask administration interface. Discord users select a model, send questions, and can inspect or clear per-user conversation memory; the bot uses stored preferences and history to provide context to the AI. Administrators configure the service and manage models through the web interface. The README documents these capabilities, while some command and route implementations are omitted from the excerpts, so uncertain wiring is not shown.
Main entry points: database.py Application database · discord_bot.py Bot commands · flask_web.py Web routes · openrouter_client.py OpenRouter client
Components 15
Discord chat
- Bot commands
discord_bot.py - Model preferences
discord_bot.py - Chat memory
discord_bot.py
Web administration
- Web routes
flask_web.py - Admin pages
templates - Setup settings
setup_config.json
AI integration
- OpenRouter client
openrouter_client.py
Persistent state
- Application database
database.py - AI model records
database.py - User preferences
database.py - Conversation history
database.py
Other components
- Discord user
- Discord
- Administrator
- OpenRouter API
Connections 17
- Discord user → Discord: uses commands
- Discord → Bot commands: dispatches commands
- Bot commands → Model preferences: reads and updates
- Bot commands → Chat memory: reads and clears
- Model preferences → Application database: reads and writes
- Chat memory → Application database: reads and writes
- Bot commands → OpenRouter client: requests AI response
- OpenRouter client → OpenRouter API: sends API requests
- OpenRouter API → OpenRouter client: returns completions
- Administrator → Admin pages: manages settings
- Admin pages → Web routes: submits requests
- Web routes → Setup settings: reads and writes
- Web routes → Application database: manages models
- Web routes → OpenRouter client: tests models
- Application database → AI model records: stores
- Application database → User preferences: stores
- Application database → Conversation history: stores