/gpt-discord

Seamless multiplayer ChatGPT in your Discord server. Supports GPT-4 Turbo with streamed responses! 🔥

Primary LanguagePython

gpt-discord (by jakobdylanc)

The best ChatGPT experience for your Discord server.

Features

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.

STREAMED RESPONSES

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 :)

AND MORE...

  • Easily set a custom personality
  • User identity aware
  • Fully asynchronous
  • 1 Python file, <100 lines of code

Instructions

Before you start, install Python and clone this git repo.

  1. Install Python requirements:
pip install -r requirements.txt
  1. 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!
  1. 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
  1. Run the bot:
python gpt-discord.py