Skip to content

hihumanzone/Gemini-Discord-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

463 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gemini Discord Bot

Node.js Discord.js Gemini API License: MIT

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.

What It Does

  • 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

Quick Start

1) Requirements

2) Install

git clone https://github.com/hihumanzone/Gemini-Discord-Bot.git
cd Gemini-Discord-Bot
npm install

3) Configure Environment

Create a .env file:

DISCORD_BOT_TOKEN=your_discord_bot_token
GOOGLE_API_KEY=your_google_api_key

4) Run

npm start

Discord Bot Setup Checklist

Enable 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

Commands

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.

How Memory Works

  • 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.

Screenshots

Settings UI

Control Center Session Manager Server and Channel Settings Custom Personality Modal

Chat and Responses

Basic Mention Reply Custom Personality Reply

Tooling and Grounded Responses

Code Execution Prompt and Output Code Code Execution Generated Files Google Search Grounding Part 1 Google Search Grounding Part 2

Downloads and Sharing

Content Sent Confirmation Message Content Download Link Session Conversation Download Link

Configuration

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

Project Structure

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/.

Notes

  • Keep .env private and never commit secrets.
  • Conversation/state is persisted locally as JSON files.

License

MIT (LICENSE.md)

About

A Discord bot leveraging Google Gemini. Has image/video/audio recognition, conversation engagement, and content understanding.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors