中文 | 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 key
in 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 Application
in 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 INTENT
below needs to be turned on- Click
Save Change
- The token can be viewed by selecting
View Token
on the top or it will be aReset Token
button if it has already been applied.
- Enter the left side
- Set up OAuth2
- Click on
OAuth2
in the left column - Click on
URL Generator
in the left column - In the right column, select bot under
SCOPES
and selectAdministrator
underBOT PERMISSIONS
at 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
Star
to support the developer - Click
Fork
to copy all the code to your own repository
- Deployment (free space):
- Go to replit
- Click
Sign Up
and sign in directly with yourGithub
account and authorize -> clickSkip
to skip the initialization setup - In the middle of the homepage, click
Create
-> a dialog box will appear, clickImport from Github
in 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 URL
can choose theChatGPT-Discord-Bot
project -> clickImport from Github.
- Environment variable settings
- After completing the previous step of importing, click on
Tools
at the bottom left of theReplit
project management page, then click onSecrets
. - After clicking
Got it
on 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
Run
at 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 CRONJOB
in the upper right corner of the backend - Enter
ChatGPT-Discord-Bot
forTitle
and 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.