Discord Bot
AI Integration
Gemini (via google-genai) powers three features. Results are cached aggressively, and the system degrades gracefully when no key is configured.
Where Gemini is used
Screenshot analysis
cogs/screenshots.py
Reads KSP screenshots a member uploads, recognising milestones and feeding them into progression.
Weekly mission text
cogs/weeklymissions.py
Generates the wording for each week's community missions.
Mission classification
api_server.py
Classifies each mission as a craft-build or active-vessel objective so the mod knows how to handle it.
Caching
Classification results are stored in the mission_classifications collection in Firestore, so the model is called at most once per week per set of missions. That keeps both cost and latency predictable.
Discord: Gemini screenshot analysis result
Image placeholder · 16/9
Graceful degradation
No key, no problem
If GEMINI_API_KEY is unset, screenshot analysis is disabled and mission classification falls back to keyword heuristics. The rest of the bot runs normally.