Build your own Discord bot with multiple AI providers
[!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
.env.example
to .env
pip3 install -r requirements.txt
to install the required dependenciesGet the token from bot setting
Store the token to .env
under the DISCORD_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
python3 main.py
or python main.py
to run the botBuild 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 botOutdated model, close to GPT-3.5 or GPT-4 capabilities
No configuration required
.env
: OPENAI_KEY=your_api_key_here
.env
: CLAUDE_KEY=your_api_key_here
.env
: GEMINI_KEY=your_api_key_here
.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:
/draw [prompt] openai
/draw [prompt] gemini
system_prompt.txt
Go Discord setting turn developer mode
on
Right-click the channel you want to recieve the message, Copy ID
paste it into .env
under DISCORD_CHANNEL_ID
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:
ADMIN_USER_IDS
in .env
with comma-separated Discord user IDs/switchpersona
Warning Jailbreak personas may generate content that bypasses normal AI safety measures. Admin access required.