# Repository Briefing: Kav-K/GPTDiscord
> Source: https://repoforai.com/repo/Kav-K/GPTDiscord (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/Kav-K/GPTDiscord
- **Category**: Chat UI & AI Apps (聊天界面与 AI 应用)
- **Primary Language**: Python
- **License**: MIT
- **Engineering Health**: A (83/100 · Maintenance 26/35 · Adoption 20/25 · Releases 17/20 · License 20/20)
- **Latest Release**: v13.2.6 (2026-10-18) — https://github.com/Kav-K/GPTDiscord/releases
- **Review Snapshot**: 2026-12-04
- **Deployment / Stack Signals**: Docker, Self-Hosted, CLI, API
- **Momentum**: 1,851 ★ total (+0 24h / +0 7d) · 292 forks
- **Topics**: `artificial-intelligence`, `asyncio`, `gpt3`, `help-wanted`, `openai`, `openai-api`, `python`, `dalle2`, `embeddings`, `extractive-question-answering`, `pinecone`, `moderator-bot`
- **When to Use**: Best for: Discord communities or internal teams that want shared AI conversations, search, and moderation in their existing channels and have an operator to manage roles, API keys, and persistent storage. Skip if: You need offline inference, cannot send content to external providers, do not want Discord as a dependency, or need durable delivery for every incoming turn.

## Overview
```text
### Architecture & Core Mechanics
GPTDiscord is a self-hosted Python application that uses Discord as its user interface and hosted APIs for model work. `gpt3discord.py` starts the bot, which is also packaged as the `gpt3discord` console command. The tree separates `cogs/`, `services/`, and `models/`; dependencies include py-cord and pycord-multicog for Discord integration, the OpenAI SDK for model calls, and sqlitedict for SQLite-backed storage.

Slash commands and Gateway events are the normal interaction paths. Startup syncs commands only in `ALLOWED_GUILDS`, leaving global registrations and other servers untouched. Core chat uses Chat Completions, while OpenAI-backed `/web` uses Responses with native web search. A compatible base URL can therefore work for chat without supporting synthesized web answers. Optional integrations are installed separately; durable recovery cursors live in `DATA_DIR/conversation_recovery.sqlite`.

### Key Capabilities & Differentiators
`/gpt ask` and `/gpt converse` support vision and reasoning models, omitting incompatible sampling options for reasoning requests. `/dalle draw` retains its old command name but uses GPT Image and returns image bytes as Discord attachments. The bot also supports transcription, moderation, personal API keys, and owner-only TXT conversation exports. Access can be restricted by exact Discord role IDs, with per-feature role checks still in force.

`/web` can return up to five linked excerpts from Parallel Search MCP without an API key, or generate a cited answer through OpenAI with model and hosted-search charges. It does not fall back to the other provider on failure. Optional `/internet chat` is a separate conversational workflow and can use OpenAI search without Google credentials. Document Q&A, Qdrant or Pinecone memory, E2B code execution, and Replicate fallback vision are optional. Qdrant and Pinecone are mutually exclusive; with neither configured, the bot keeps local conversation summaries.

### Trade-offs & Limitations
Compared with a browser-first chat UI, GPTDiscord puts access controls and shared workflows in the server where users already work, but ties the experience to Discord permissions, intents, and delivery. Compared with a managed bot, it gives operators direct control over configuration, credentials, and persisted state at the cost of maintaining the deployment and its integrations. Self-hosting the bot does not make inference offline or remove provider charges and data-transfer considerations.

For selected guilds with Gateway delivery gaps, opt-in REST recovery polls explicitly registered conversations at a nominal three-second interval and processes up to four sessions concurrently while preserving order within each session. It does not recover edits, free mentions, or general moderation events. SQLite cursors enforce at-most-once ingress: a failure after claiming a turn can leave it unanswered, and the mechanism does not guarantee exactly-once provider billing.

### Hardware & Deployment Guide
Use Python 3.11–3.13 with `pip install .`, then run `python gpt3discord.py` or `gpt3discord`. Configure the Discord bot token, allowed guild IDs, a writable `DATA_DIR`, and an OpenAI key for the core OpenAI features. Enable the Server Members and Message Content intents and invite the bot with `bot` and `applications.commands` scopes. Source installs need system FFmpeg to transcribe downloaded media. Core inference runs remotely, so no GPU is required; size the host for concurrency, attachments, and local state.

Docker Compose builds the base image by default, includes FFmpeg, and mounts a named volume at `/data`. Set `FULL=true` at build time for optional integrations and ensure any bind mount is writable by UID/GID `10001`. Back up existing state before upgrading and rebuild indexes when changing embedding models. The v13.2.4–v13.2.6 sequence removes retired API settings and obsolete image paths, then hides commands for services that are not loaded.
```

## Key Capabilities
```text
- API separation: Core chat uses Chat Completions; synthesized `/web` answers require Responses with native web search.
- Search modes: Parallel returns up to five linked excerpts without a key; OpenAI synthesizes cited answers and incurs API charges.
- Access control: Exact role-ID restrictions cover commands, buttons, modals, autocomplete, and processed messages, and deny DMs when enabled.
- Delivery recovery: REST polling covers explicitly registered sessions; SQLite cursors deduplicate ingress across polling, Gateway overlap, and restarts.
- Integration loading: v13.2.6 hides commands for unloaded services from both Discord and `/help`.
- Container operations: Compose builds the base image by default, runs as UID/GID `10001`, and persists `/data` in a named volume.
```

## Quick Start / Clone
```bash
cp sample.env .env
# Edit .env, then:
docker compose up --build -d
docker compose logs -f
```
