Zero6992 / chatGPT-discord-bot
- понедельник, 6 февраля 2023 г. в 00:38:56
Integrate ChatGPT into your own discord bot
Build your own Discord bot using ChatGPT
Warning
2023-02-03 Update: ChatGPT API working again
2023-02-02 Update: OpenAI has closed ChatGPT API, temporarily switching to using GPT-3 model
2023-02-01 Update: Now using the official ChatGPT API
/chat [message]
Chat with ChatGPT!/private
ChatGPT switch to private mode/public
ChatGPT switch to public mode/reset
ChatGPT conversation history will be erasedpublic mode (default)
the bot directly reply on the channel
private mode
the bot's reply can only be seen by the person who used the command
pip install -r requirements.txt
config.dev.json
to config.json
Go to https://discord.com/developers/applications create an application
Build a Discord bot under the application
Get the token from bot setting
Store the token to config.json
under the discord_bot_token
Turn MESSAGE CONTENT INTENT ON
Invite your bot to your server via OAuth2 URL Generator
Click Create new secret key
Store the SECRET KEY to config.json
under the openAI_key
python3 main.py
to start the botBuild the Docker image & Run the Docker container docker compose up -d
Inspect whether the bot works well docker logs -t chatgpt-discord-bot
docker ps
to see the list of running servicesdocker stop <BOT CONTAINER ID>
to stop the running botA starting prompt would be invoked when the bot is first started or reset
You can set it up by modifying the content in starting-prompt.txt
All the text in the file will be fired as a prompt to the bot
Get the first message from ChatGPT in your discord channel!