An intelligent, multi-user Discord bot powered by OpenAIβs GPT-4o, designed for fast, contextual conversations with real-time memory, personality modes, rate limiting, and Dockerized deployment.
!ask <message>
β Ask anything and receive smart, contextual replies from GPT-4o.- β GPT-4o model β Fast, lightweight, and supports multi-modal inputs (future-ready).
- π§΅ Per-user memory β Persist user conversations using Redis.
- 𧬠Personas β Choose between assistant styles like
tutor
,critic
,meme
, and more. - π Rate limiting β Enforces per-user message and token quotas.
- π Environment-based config β Secure token/key management via
.env
. - π³ Docker-ready β Easy to deploy in any environment with Docker.
- βοΈ Modular codebase β Clean, extensible service-layer architecture.
Component | Description |
---|---|
Python (async) |
Async I/O for scalable operations |
discord.py |
Discord bot framework |
OpenAI SDK |
Interface to GPT-4o |
Redis |
Per-user memory storage |
dotenv |
Environment config |
Docker |
Containerized deployment |
π¬ Bot Commands Command Description !ask Ask GPT-4o a question. !mode Change assistant persona (tutor, critic, etc.). !modes List all available modes. !reset Reset memory and persona for your session. !tokens Show your total token usage. !usage Show your daily usage and limits.
π§© Available Modes (Personas) default β A helpful assistant.
tutor β A patient, step-by-step teacher.
critic β A brutally honest code reviewer.
meme β Replies with memes and Gen-Z slang.
pirate β Talks like a sarcastic pirate.
π Rate Limits (Default) Limit Type Value Tokens/day 10,000 Messages/day 100
(Limits can be changed in services/rate_limiter.py)
git clone https://github.com/yourusername/chatgpt-discord-bot.git
cd chatgpt-discord-bot
Create a .env File
DISCORD_TOKEN=your-discord-bot-token
OPENAI_API_KEY=your-openai-api-key
Install Dependencies
pip install -r requirements.txt
Run the Bot
python bot/main.py