AI Discord bot powered by Google Gemini with streaming responses, multimodal input, session-based memory, and rich settings UI.
For voice-channel conversations with Gemini Live API, see Gemini-Live-discord, a Discord bot for natural voice conversations with Gemini.
- Chats in DMs or in servers (mention, always-respond mode, or personal active mode)
- Understands text, images, videos, audio, PDFs, and office/code files
- Supports per-user sessions plus optional channel-wide or server-wide shared memory
- Lets users toggle Gemini tools (Google Search, URL Context, Code Execution)
- Provides admin controls for moderation and server/channel behavior
- Includes Nano Banana mode for advanced image generation and editing capabilities
- Exports message content and full conversation history as shareable links
- Node.js 20+
- Discord bot token: https://discord.com/developers/applications
- Google Gemini API key: https://aistudio.google.com/app/apikey
git clone https://github.com/hihumanzone/Gemini-Discord-Bot.git
cd Gemini-Discord-Bot
npm installCreate a .env file:
DISCORD_BOT_TOKEN=your_discord_bot_token
GOOGLE_API_KEY=your_google_api_keynpm startEnable these intents in the Discord Developer Portal:
- Guilds
- Guild Messages
- Message Content
- Direct Messages
Recommended bot permissions:
- Send Messages
- Embed Links
- Attach Files
- Use Slash Commands
- Manage Messages
| Command | Who can use it | Purpose |
|---|---|---|
/settings |
Everyone | Open personal control center |
/clear_memory |
Everyone | Clear active session memory |
/status |
Everyone | Show CPU/RAM and reset timer |
/channel_settings |
Admin | Configure channel behavior |
/server_settings |
Admin | Configure server-wide behavior |
/block user:@user |
Admin | Block a user in this server |
/unblock user:@user |
Admin | Remove user block |
Slash commands are checked on startup and auto-synced when changes are detected.
- User sessions: each user can maintain multiple independent conversations.
- Channel-wide history: one shared memory per channel.
- Server-wide history: one shared memory for the whole server.
- If shared history is enabled (channel/server), it overrides personal session history in that scope.
Core defaults live in config.js:
- Default Model:
gemini-flash-lite-latest - Nano Banana Model:
gemini-2.5-flash-image - Enable Nano Banana Mode:
true - Max generation attempts:
3 - Default response mode:
Embedded - Tool defaults: Google Search = on, URL Context = on, Code Execution = off
src/
core/ runtime setup and shared paths
handlers/ message and interaction routing
services/ Gemini orchestration, attachments, streaming, sessions
state/ JSON persistence, history lifecycle, locking
ui/ Discord settings views and action buttons
utils/ Discord and error formatting helpers
Runtime data is stored in data/ and temporary files in temp/.
- Keep
.envprivate and never commit secrets. - Conversation/state is persisted locally as JSON files.
MIT (LICENSE.md)












