Important
Major Refactor (2025/07):
- 5 AI Providers: Free (g4f), OpenAI, Claude, Gemini, Grok
- No Cookie Authentication: Removed unreliable cookie-based auth for free providers
- Python 3.9 or later
- Rename the file
.env.example
to.env
- Running
pip3 install -r requirements.txt
to install the required dependencies - Optional: API keys for premium providers (OpenAI, Claude, Gemini, Grok)
-
Go to https://discord.com/developers/applications create an application
-
Build a Discord bot under the application
-
Get the token from bot setting
-
Store the token to
.env
under theDISCORD_BOT_TOKEN
-
Turn MESSAGE CONTENT INTENT
ON
-
Invite your bot to your server via OAuth2 URL Generator
-
Open a terminal or command prompt
-
Navigate to the directory where you installed the ChatGPT Discord bot
-
Run
python3 main.py
orpython main.py
to run the bot
-
Build the Docker image & run the Docker container with
docker compose up -d
-
Inspect whether the bot works well
docker logs -t chatgpt-discord-bot
docker ps
to see the list of running servicesdocker stop <BOT CONTAINER ID>
to stop the running bot
Outdated model, close to GPT-3.5 or GPT-4 capabilities
No configuration required
- Obtain your API key from https://platform.openai.com/api-keys
- Add to
.env
:OPENAI_KEY=your_api_key_here
- Get API key from https://console.anthropic.com/
- Add to
.env
:CLAUDE_KEY=your_api_key_here
- Get API key from https://ai.google.dev/
- Add to
.env
:GEMINI_KEY=your_api_key_here
- Get API key from https://x.ai/api
- Add to
.env
:GROK_KEY=your_api_key_here
Use /provider
command in Discord to switch between available providers
Image generation is now integrated with the provider system:
- Requires OpenAI API key
- High-quality image generation
- Use
/draw [prompt] openai
- Requires Gemini API key
- Free tier available
- Use
/draw [prompt] gemini
- If premium providers are unavailable, the bot will attempt to use free alternatives
- Image generation capabilities vary by provider availability
-
A system prompt would be invoked when the bot is first started or reset
-
You can set it up by modifying the content in
system_prompt.txt
-
All the text in the file will be fired as a prompt to the bot
-
Get the first message from ChatGPT in your discord channel!
-
Go Discord setting turn
developer mode
on
- Set the value of
LOGGING
in the.env
to False
/chat [message]
- Chat with the current AI provider/provider
- Switch between AI providers (Free, OpenAI, Claude, Gemini, Grok)/draw [prompt] [model]
- Generate images with specified provider/reset
- Clear conversation history/help
- Display all available commands
/switchpersona [persona]
- Switch AI personality (admin-only for jailbreaks)standard
- Standard helpful assistantcreative
- More creative and imaginative responsestechnical
- Technical and precise responsescasual
- Casual and friendly tonejailbreak-v1
- BYPASS mode (admin only)jailbreak-v2
- SAM mode (admin only)jailbreak-v3
- Developer Mode Plus (admin only)
/private
- Bot replies only visible to command user/public
- Bot replies visible to everyone (default)/replyall
- Bot responds to all messages in channel (toggle)
Jailbreak personas require admin privileges for enhanced security:
- Set
ADMIN_USER_IDS
in.env
with comma-separated Discord user IDs - Only admin users can access jailbreak personas
- Regular users see only safe personas in
/switchpersona
Warning Jailbreak personas may generate content that bypasses normal AI safety measures. Admin access required.
- No cookie-based authentication (removed for reliability)
- Secure API key management via environment variables
- Docker security hardening with non-root user
- Read-only filesystem for container security