The best ChatGPT experience for your Discord server.
REPLY-BASED CHAT HISTORY
Mention (@) the bot and it will reply to you. Reply to any message to continue the conversation from that point. The chat history is built dynamically from reply chains.
The bot's replies start generating instantly rather than having to wait longer for one big chunk.
As of writing this no other GPT Discord bot has successfully implemented this. Feel free to prove me wrong :)
- Easily set a custom personality
- User identity aware
- Fully asynchronous
- 1 Python file, <100 lines of code
Before you start, install Python and clone this git repo.
- Install Python requirements:
pip install -r requirements.txt
- Create .env from .env.example and set it up:
Setting | Instructions |
---|---|
DISCORD_BOT_TOKEN | Create a new Discord application at discord.com/developers/applications and generate a token under the "Bot" tab. Also enable "message content intent". |
OPENAI_API_KEY | Generate an OpenAI API key at platform.openai.com/account/api-keys. You must also add a payment method to your OpenAI account at platform.openai.com/account/billing/payment-methods. |
GPT_MODEL | Choose either "gpt-3.5-turbo" or "gpt-4-turbo". More info on OpenAI models: platform.openai.com/docs/models |
CUSTOM_SYSTEM_PROMPT | Write practically anything you want to customize the bot's behavior! |
- Invite the bot to your Discord server with this URL (replace <CLIENT_ID> with your Discord application's client ID found under the "OAuth2" tab):
https://discord.com/api/oauth2/authorize?client_id=<CLIENT_ID>&permissions=412317273088&scope=bot
- Run the bot:
python gpt-discord.py