A Discord bot backed by Google's Gemini models with built-in Google Search grounding — so when you ask about news, prices, or anything current, it searches the web and answers from live results instead of guessing. Pick a model per channel with !listen, then just type to talk, or @mention the bot anywhere for a one-off answer.
- Grounded answers. Free-form chat automatically uses Google Search so answers about current events are based on live results, not stale training data.
- Per-channel model picker.
!listenlets each channel choose a Gemini model — 2.5 Flash-Lite (fast/cheap), 2.5 Flash, or 2.5 Pro — and remembers it. Add or change models by editing one list inbot.py. - Just type to talk. Once a channel is in chat mode, plain messages go to the model. Or
@mentionthe bot in any channel without entering chat mode. - Server-aware helpers.
!summarizesummarizes any channel;!serveranswers a question from the last 3 days of activity across the whole server. - Maps on request. Ask for directions/a place and the model can drop a clickable Google Maps link.
- Short per-channel memory and automatic splitting of long replies to fit Discord's limit.
- Python 3.9+ (download).
- A Discord bot token — free; created in the Discord Developer Portal (walkthrough).
- A Gemini API key — free tier available from Google AI Studio.
- Safety filters are configurable. By default the bot uses Google's standard safety filtering; you can set
SAFETY_FILTERS=offin.envto disable them on a private server (see notes below).
Unlike a local-model bot, this one sends your prompts to Google's Gemini API to generate answers — that's how it works. Nothing else leaves your machine.
Mac: download this project (green Code button → Download ZIP), unzip it, double-click install-mac.command (first time: right-click → Open → Open), paste your token + key into the new .env file, then double-click start-mac.command.
Windows: unzip, double-click install-windows.bat, edit .env, then double-click start-windows.bat.
Any OS:
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # then edit .env with your token + key
python bot.pyThe full walkthrough — creating the Discord bot, enabling intents, inviting it, and getting a Gemini key — is in INSTALL.md.
| Command | What it does |
|---|---|
!listen |
Put this channel into chat mode; reply with a number to pick a Gemini model. Then just type to talk. |
!summarize |
Summarize the recent history of a channel you pick. |
!server <question> |
Answer using the last 3 days of activity across the server. |
You can also @mention the bot in any channel to ask a one-off question (with web grounding on).
All settings live in a .env file (the installer creates it from .env.example):
DISCORD_TOKEN=your_bot_token_here
GEMINI_API_KEY=your_gemini_api_key_here
GEMINI_MODEL=gemini-2.5-flash-lite
SAFETY_FILTERS=onDISCORD_TOKEN and GEMINI_API_KEY are required. Your .env stays on your machine and is never uploaded. To change the models offered by !listen, edit the MODELS dict near the top of bot.py.
- Both keys are passwords. They live only in
.env, which is git-ignored. If a key leaks, rotate it: Discord (Bot → Reset Token) or Gemini (delete the key in AI Studio and make a new one). - Safety filters:
SAFETY_FILTERS=on(the default) uses Google's default content filtering. Setting it tooffdisables all filters (BLOCK_NONE) — only do that on a private server you control, and understand you're turning off Gemini's guardrails. - The bot reads message content in servers it joins (required for a prefix bot), so add it only to servers you trust.
Released under the MIT License — free to use, modify, and share. See LICENSE.
I build and share these tools for free in my spare time. If this bot is useful to you, you can buy me a coffee — genuinely appreciated, and it helps me keep making things like this. Enjoy! 🙌
