https://github.com/squatboy/gemini-discord-summarizer-bot
discord bot for summarizing discord channel messages using gemini model
https://github.com/squatboy/gemini-discord-summarizer-bot
discord discord-bot discord-py gemini gemini-api python summarize
Last synced: about 1 month ago
JSON representation
discord bot for summarizing discord channel messages using gemini model
- Host: GitHub
- URL: https://github.com/squatboy/gemini-discord-summarizer-bot
- Owner: squatboy
- Created: 2025-05-04T19:14:01.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-07T05:17:20.000Z (about 1 year ago)
- Last Synced: 2025-06-07T06:20:39.986Z (about 1 year ago)
- Topics: discord, discord-bot, discord-py, gemini, gemini-api, python, summarize
- Language: Python
- Homepage:
- Size: 38.3 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## π°π· README [νκ΅μ΄ 보기](#νκ΅μ΄)
# `discord-channelmessage-summarize-bot`
## Intro
a Discord bot that summarizes conversation history in Discord channels using the Google Gemini model. It helps users quickly grasp the essence of long conversations, making it easier to catch up on important information or missed details. It offers both immediate summary via slash commands for specific time ranges and an automatic daily summary feature for a configured channel.
## Deploy

Can be deployed in a cloud environment like above diagram. For 24/7 hosting & smaller-scale deployments, it can be easily configured with free tiers or serverless services, similar to my own setup.
```Use it as a reference only. Design an architecture that best suits your service's scale.```
## Features
* **`Conversation Summarization`:** Summarizes Discord channel message content using the Google Gemini API.
* **`Slash Commands`:** Supports slash commands for instant summarization of messages within specific time ranges (1 hour, 6 hours, 24 hours).
* **`Automatic Daily Summary`:** Automatically summarizes the previous day's conversation in a designated channel at midnight in the configured timezone.
* **`Long Message Splitting`:** Automatically splits long summary results into multiple messages to comply with Discord's message length limits.
* **`Configurable`:** Easy configuration via environment variables for Discord token, Google API key, target channel ID
## Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
### Prerequisites
* Python 3.8 or higher installed π
* A Discord Bot Application created and the Bot Token π
* Gemini API Key π
> Enable the **Message Content Intent** for your bot in the Discord Developer Portal (under Bot settings) β
### Installation
1. **Clone the repository:**
```bash
git clone https://github.com/squatboy/gemini-discord-summary-bot.git
cd gemini-discord-summary-bot
```
2. **Create a virtual environment (recommended):**
```bash
python -m venv venv
# Windows
.\venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
```
3. **Install dependencies:**
Install the required libraries. You will need a `requirements.txt` file containing the following:
```txt
discord.py
google-generativeai
python-dotenv
pytz
```
```bash
pip install -r requirements.txt
```
## Configuration
You need to create a `.env` file in the project's root directory and set the following environment variables.
### `.env` File Setup
```dotenv
DISCORD_TOKEN=YOUR_DISCORD_BOT_TOKEN
GOOGLE_API_KEY=YOUR_GOOGLE_GEMINI_API_KEY
TARGET_CHANNEL_ID=YOUR_TARGET_CHANNEL_ID_FOR_DAILY_SUMMARY
```
## Commands

---
## νκ΅μ΄
## μκ°
Discord μ±λμ λν λ΄μ©μ Google Gemini λͺ¨λΈμ νμ©νμ¬ μμ½ν΄ μ£Όλ Discord λ΄μ
λλ€. κΈ΄ λν λ΄μ©μ λΉ λ₯΄κ² νμ
νμ¬ μ€μν μ 보λ λμΉ λ΄μ©μ μ½κ² νμΈνλ λ° λμμ μ€λλ€. νΉμ μκ° λ²μμ λ©μμ§λ₯Ό μ¦μ μμ½νκ±°λ, μ€μ λ μ±λμμ λ§€μΌ μλμΌλ‘ μ λ μ λν λ΄μ©μ μμ½νλ κΈ°λ₯μ μ 곡ν©λλ€.
## λ°°ν¬

μ λ€μ΄μ΄κ·Έλ¨κ³Ό κ°μ΄ ν΄λΌμ°λ νκ²½μμ λ°°ν¬ν μ μμΌλ©°, 24/7 νΈμ€ν
& μκ·λͺ¨μ κ²½μ° μ λ λΉμ·νκ² free tierλ€λ‘ ꡬμ±νκ±°λ serverless μλΉμ€λ€λ‘ κ°λ¨νκ² κ΅¬μ±μ΄ κ°λ₯ν©λλ€
## μ£Όμ κΈ°λ₯
* **λν μμ½:** Google Gemini APIλ₯Ό μ¬μ©νμ¬ Discord μ±λμ λ©μμ§ λ΄μ©μ μμ½ν©λλ€.
* **μ¬λμ 컀맨λ:** νΉμ μκ°(1μκ°, 6μκ°, 24μκ°) λμμ λ©μμ§λ₯Ό μ¦μ μμ½νλ μ¬λμ 컀맨λλ₯Ό μ§μν©λλ€.
* **μλ μΌμΌ μμ½:** μ€μ λ μκ°λμ μμ μ νΉμ μ±λμ μ λ λν λ΄μ©μ μλμΌλ‘ μμ½νμ¬ μ μ‘ν©λλ€.
* **κΈ΄ λ©μμ§ λΆν :** μμ½ κ²°κ³Όκ° Discord λ©μμ§ κΈΈμ΄ μ νμ μ΄κ³Όν κ²½μ° μλμΌλ‘ λΆν νμ¬ μ μ‘ν©λλ€.
## μμνκΈ°
νλ‘μ νΈλ₯Ό λ‘컬 νκ²½μμ μ€ννκΈ° μν μ€μ λ°©λ²μ
λλ€.
μ½λ λ΄λΆ λ‘μ§μ λν μ€λͺ
λ° λ©μΈμ§ μμ½ μΈμ΄λ₯Ό νκ΅μ΄λ‘ μνμλ©΄
νλ‘μ νΈ λ΄λΆ λλ ν 리 `korean-v1` λ₯Ό μ¬μ©νμλ©΄ λ©λλ€.
### νμ 쑰건
* Python 3.8 μ΄μ λ²μ μ€μΉ π
* Discord λ΄ μ ν리μΌμ΄μ
μμ± λ° λ΄ ν ν° ν보 π
* Gemini API ν€ π
* Discord λ΄μ λ©μμ§ λ΄μ© μΈν
νΈ(Message Content Intent) νμ±ν (Discord κ°λ°μ ν¬νΈμμ λ΄ μ€μ μμ νμ±ν) β
### μ€μΉ
1. **μ μ₯μ ν΄λ‘ :**
```bash
git clone [νλ‘μ νΈ μ μ₯μ URL]
cd [νλ‘μ νΈ ν΄λ]
```
2. **κ°μ νκ²½ μ€μ (κΆμ₯):**
```bash
python -m venv venv
# Windows
.\venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
```
3. **μ’
μμ± μ€μΉ:**
νλ‘μ νΈμ νμν λΌμ΄λΈλ¬λ¦¬λ₯Ό μ€μΉν©λλ€. μλ λ΄μ©μ ν¬ν¨νλ `requirements.txt` νμΌμ΄ νμν©λλ€.
```txt
discord.py
google-generativeai
python-dotenv
pytz
```
```bash
pip install -r requirements.txt
```
## μ€μ
νλ‘μ νΈ λ£¨νΈ λλ ν 리μ `.env` νμΌμ μμ±νκ³ λ€μ νκ²½ λ³μλ₯Ό μ€μ ν΄μΌ ν©λλ€.
### `.env` νμΌ μ€μ
```dotenv
DISCORD_TOKEN=YOUR_DISCORD_BOT_TOKEN
GOOGLE_API_KEY=YOUR_GOOGLE_GEMINI_API_KEY
TARGET_CHANNEL_ID=YOUR_TARGET_CHANNEL_ID_FOR_DAILY_SUMMARY