An innovative project that seamlessly integrates ChatGPT into Discord, revolutionizing the way you collaborate with your team! This powerful tool enables both text and image generation on-demand, fostering creativity and efficiency in your project discussions. Not only does it harness the power of ChatGPT, but it also utilizes DALL-E 2 for advanced image generation capabilities.
Designed as a personal team assistant, ChatGPT-Discord anticipates your needs, automating tasks and providing valuable insights to streamline your team's workflow. Get ready to experience a whole new level of productivity and creativity with ChatGPT-Discord, the ultimate AI-powered collaboration booster for your Discord channels!
Step 1 Create an account/login to account ChatGPT Website
- When using chatGPT for the first time, go to the chatGPT website to create an account
- Click on "Sign up" to register account, or "Log in" if you have one.
Step 2 Access to ChatGPT API
- Once logged in, go to this website for API claims:
- Login to account and click on "Create New Security Key" to create the API key.
1)The key will only be displayed once!!! Remember to keep it safe! If the key is not saved in time, it will have to be recreated!
2)Every API comes with limited free quota, for details please see API documentation.
Step 3 To obtain a Discord token:
-
Log in to the Discord Developer portal.
-
Click on the "New Application" button in the top right corner and enter the name of bot in the provided field.
-
Click on the "Bot" tab on the left-hand side and then click the "Add Bot" button to create a bot for application.
-
Scroll down to the "Token" section and click on the "View Token" button to reveal the token.
-
Scroll down to the "Privileged Gateway Intents" section and toggle on the "Message Content" intent. And then, click on the "Save Changes" button to save your changes.
Step 4 To set up OAuth:
- Go to the "OAuth2" section and click on the "URL Generator" option.And then, select "bot" in the "SCOPES" section and select "Administrator" in the "BOT PERMISSIONS" section.
- Copy the URL at the bottom of the page and paste it into your web browser.
- Select the server you want to add the bot to and click "Continue" and authorize the bot to join the server.
Step 5 Fork code from Github
- Go to the Integrate-ChatGPT-into-Discord on GitHub.
- Click on the "Star" button to support the developer.
- Click on the "Fork" button to copy the code.
Step 6 Deploy for free
- Go to the Replit.
- Click on the "Sign Up" and sign in with Github account. You can click "Skip" to bypass the initial setup process.
- On the Replit homepage, click on "Create" in the center of the page. In the pop-up window, click on "Import from Github" in the top right corner.
- Just wait for it~
Step 7 set environment variables
- Click on "Tools" in the bottom left corner of the page and select "Secrets". And then, Click "Got it" to proceed.
- Add the following environment variables:
-
OpenAI API Token:(View to step 2)
- key: OPENAI_API
- value: sk-FoXXXX
-
Selected model:
- key: OPENAI_MODEL_ENGINE
- value: gpt-3.5-turbo
-
Role word for ChatGPT to play (Users can set their own prompt words for the role that ChatGPT will play.):
- key: SYSTEM_MESSAGE
- value: Assist an agile development team of 7-9 members, including a product owner, scrum master, and development team, with daily project management tasks while facilitating open and equal communication among team members..
-
Discord Token:(View to step 3)
- key: DISCORD_TOKEN
- value: MTA3NXXX
Step 8 Run the code
- Click on "Run". If the Code is running successfully, the screen will display the message "Hello. I am alive!". Make sure to copy the URL, as it will be used in the next step.
Notice:
- If there are no requests made within an hour, the program will be interrupted. Therefore, the following steps need to be taken.
-
Register to cron-job.org to set up scheduled requests.(Free)
-
Select "CREATE CRONJOB" in the upper right corner of the dashboard.
-
In the "Title" field, enter "Integrate-ChatGPT-into-Discord".
-
In the "URL" field, enter the URL obtained from the previous step. Set the frequency to every 5 minutes. And Click on "CREATE" to create the CronJob.
Command | Description |
---|---|
/chat | Enter "/chat" in the text input box followed by a message to call the ChatGPT model. |
/reset | Use this command to clear ChatGPT's memory of the last ten interactions. |
/imagine | Enter "/imagine" in the text input box followed by a prompt to call the DALL-E 2 model and generate an image. |
Notice: To adjust the size of images generated by the DALL-E 2, modify the "image_size" parameter in /src/models/OpenAIModel.
If you think this small application useful and would like to show your appreciation, please consider buying me a cup of coffee to support my efforts! Your generosity will not only fuel my motivation to continue working on this project, but also help me cover the costs associated with development and maintenance.
Thank you for your support! 🙏