中文 | English
ChatGPT is integrated with Discord, allowing teams to collaborate, communicate, and be more efficient. By following the installation steps below, you too can import ChatGPT into your Discord.
- 2023/03/03 Model change to chat completion:
gpt-3.5-turbo
By importing the ChatGPT bot into every channel on Discord, simply enter /chat in the input box and the keyword /chat message will automatically be inserted. You can then enter text to interact with ChatGPT, as shown in the figure below:

- Get the API Token given by OpenAI:
- Register/login to your account on OpenAI platform
- There is a profile picture in the upper right corner. Click on it and select
View API keys. - Click on
Create new secret keyin the middle.
- Note: Each API has a free quota and restrictions. For details, please see OpenAI Pricing.
- Obtain Discord Token:
- Log in to Discord Developer
- Create a bot:
- Enter the left side
Applications - Click
New Applicationin the upper right corner and enter the name of the bot > After confirmation, enter the new page. - Click on the left side
Bot - Click on the right side
Add Bot MESSAGE CONTENT INTENTbelow needs to be turned on- Click
Save Change - The token can be viewed by selecting
View Tokenon the top or it will be aReset Tokenbutton if it has already been applied.
- Enter the left side
- Set up OAuth2
- Click on
OAuth2in the left column - Click on
URL Generatorin the left column - In the right column, select bot under
SCOPESand selectAdministratorunderBOT PERMISSIONSat the bottom right - Copy the URL at the bottom and paste it into your browser
- Choose the server you want to add the bot to
- Click
Continue>Authorize
- Click on
- Fork the Github project:
- Register/login to GitHub
- Go to ChatGPT-Discord-Bot
- Click
Starto support the developer - Click
Forkto copy all the code to your own repository
- Deployment (free space):
- Go to replit
- Click
Sign Upand sign in directly with yourGithubaccount and authorize -> clickSkipto skip the initialization setup - In the middle of the homepage, click
Create-> a dialog box will appear, clickImport from Githubin the upper right corner - If you haven't added your Github repository yet, click the link
Connect GitHub to import your private repos.-> checkOnly select repositories-> chooseChatGPT-Discord-Bot - Go back to step 4, at this point, the
Github URLcan choose theChatGPT-Discord-Botproject -> clickImport from Github.
- Environment variable settings
- After completing the previous step of importing, click on
Toolsat the bottom left of theReplitproject management page, then click onSecrets. - After clicking
Got iton the right side, you can add environment variables, which need to be added:- OpenAI API Token:
- key:
OPENAI_API - value:
[obtained from step one above] sk-FoXXXX
- key:
- Desired model:
- key:
OPENAI_MODEL_ENGINE - value:
gpt-3.5-turbo
- key:
- ChatGPT wants the assistant to play the role of a keyword (currently, no further usage instructions have been officially released, and players can test it themselves).
- key:
SYSTEM_MESSAGE - value:
You are a helpful assistant.
- key:
- Discord Token:
- key:
DISCORD_TOKEN - value:
[obtained from step one above] MTA3NXXX
- key:
- OpenAI API Token:
- After completing the previous step of importing, click on
- Start execution
- Click
Runat the top - After successful execution, the right-hand screen will display
Hello. I am alive!, and copy the URL in the upper right corner of the screen, which will be used in the next step
- Note: if there are no requests within an hour, the program will stop running, so the next step is needed
- Click
- CronJob periodic request sending
- Register/login to cron-job.org
- Select
CREATE CRONJOBin the upper right corner of the backend - Enter
ChatGPT-Discord-BotforTitleand enter the URL from the previous step for URL - Set it to run every
5 minutes - Click on
CREATE
| Command | Description |
|---|---|
/chat |
Type /chat in the input box followed by message to call the ChatGPT model and generate text. |
/reset |
ChatGPT remembers the last ten questions and answers. Calling this command will clear the history. |
/imagine |
Type /imagine in the input box followed by prompt to call the DALL·E 2 model and generate an image. |
Like this free project? Please consider supporting us to keep it running.
