Skip to content

JiaxiongWeng-Conor/Integrate-ChatGPT-into-Discord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Integrating-ChatGPT-into-Discord

Introduction:

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!

Steps for Integrating ChatGPT into Discord

Step 1 Create an account/login to account ChatGPT Website

  1. When using chatGPT for the first time, go to the chatGPT website to create an account

Github Octocat mascot

  1. Click on "Sign up" to register account, or "Log in" if you have one.

Github Octocat mascot

Step 2 Access to ChatGPT API

  1. Once logged in, go to this website for API claims:
  2. Login to account and click on "Create New Security Key" to create the API key.

Github Octocat mascot Notice:

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:

  1. Log in to the Discord Developer portal.

  2. Click on the "New Application" button in the top right corner and enter the name of bot in the provided field. Github Octocat mascot Github Octocat mascot

  3. Click on the "Bot" tab on the left-hand side and then click the "Add Bot" button to create a bot for application. Github Octocat mascot Github Octocat mascot

  4. Scroll down to the "Token" section and click on the "View Token" button to reveal the token. Github Octocat mascot Github Octocat mascot

  5. 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. Github Octocat mascot

Step 4 To set up OAuth:

  1. 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. Github Octocat mascot
  2. Copy the URL at the bottom of the page and paste it into your web browser. Github Octocat mascot
  3. Select the server you want to add the bot to and click "Continue" and authorize the bot to join the server. Github Octocat mascot

Step 5 Fork code from Github

  1. Go to the Integrate-ChatGPT-into-Discord on GitHub.
  2. Click on the "Star" button to support the developer.
  3. Click on the "Fork" button to copy the code. Github Octocat mascot

Step 6 Deploy for free

  1. Go to the Replit.
  2. Click on the "Sign Up" and sign in with Github account. You can click "Skip" to bypass the initial setup process.
  3. 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. Github Octocat mascot
  4. Just wait for it~

Github Octocat mascot

Step 7 set environment variables

  1. Click on "Tools" in the bottom left corner of the page and select "Secrets". And then, Click "Got it" to proceed.
  2. 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

  1. 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. Github Octocat mascot

Notice:

  1. If there are no requests made within an hour, the program will be interrupted. Therefore, the following steps need to be taken.
  1. Register to cron-job.org to set up scheduled requests.(Free)

  2. Select "CREATE CRONJOB" in the upper right corner of the dashboard. Github Octocat mascot

  3. In the "Title" field, enter "Integrate-ChatGPT-into-Discord".

  4. 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. Github Octocat mascot

Commond

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.

Support Me with a Cup of Coffee ☕

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.

Buy Me A Coffee

Thank you for your support! 🙏

About

JiaxiongWeng-Conor/integrate-ChatGPT-into-LINEJiaxiongWeng-Conor/integrate-ChatGPT-into-LINEJiaxiongWeng-Conor/integrate-ChatGPT-into-LINE

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages