Skip to content

ansonwcy/chatGPT_discord_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction:

This is a ChatGPT discord chatbot with bot role configuration.

How to use:

  • Config the bots (details in step 4)

  • Talk to them or type commands

Act as code assistant:

Image 3

Act as a linux terminal:

Image 2

Act as an etymologist:

Image 1


Bot Commands

  • /intro Show the which basic functions of the bot of current channel
  • /reset Clean the chat history of current channel (only available in chat model)
  • /model-setting Show the model setting of the bot of current channel
  • /channel-setting Show the channel setting of the bot of current channel
  • /source-code Show the the URL of this repo

Start the project:

Step 1. Prepare the keys & ids below

  • OpenAI API key
  • Discord API key
  • Discord server id
  • Discord bot client id

Step 2. Install dependencies

npm i

(Step 3). Create config files (if first time to run)

npm run config

Step 4. Modify the files below to config the role, personality, and function of bots in different channels.

  • src/config/bot.yml
  • src/config/config.json

Note

  • For the model name, please refer to OpenAI doc.
  • Only gpt-3.5-turbo and gpt-3.5-turbo-0301 support chat completion.
  • Other models can be used in this chatbot, but it is not recommended.
  • Set chatHistoryMaxLength smaller than 2000 due to openAI API limitation.
  • Set bot and chatHistoryMaxLength to null if it is NOT chat model.
  • For the detail setting, please refer to OpenAI doc.

Step 5. Build and run the project


For Windows

npm start

For Linux

npm run start-linux

(Step 6). Store the chat history after terminating the server if need


For Windows

npm run store

For Linux

npm run store-linux

License: MIT license


Todo:

  • Support stream request.

  • Create DB to store message.

  • Voice chat. Includes text to voice and voice to text.

About

ChatGPT discord bot

Resources

License

Stars

Watchers

Forks

Packages

No packages published