Use /chat command to send a message to the bot in public channels, and it will respond with a
message generated
by the ChatGPT API.
[Direct Message]
Send private messages to the bot, and it will respond with a message generated by the ChatGPT API. This is useful for users who want to interact with the bot without broadcasting their messages to the whole server.
The responses generated by ChatGPT are streamed in real time so that users can see the progress of the completion. This is particularly useful for chat applications in which the user doesn't have to wait for a long time to see the result.
Installation
To run this bot, please follow these steps:
Go to the releases page and download the binary that
matches your operating system. Extract the binary to a directory of your choice (such as ~/go-chatgpt-discord).
In the same directory as the binary, create a copy of env.example and name it .env Fill in the appropriate
credentials as directed.
Obtain a new OpenAI API key by following the link here. Then, fill
in OPENAI_API_KEY.
Fill out DISCORD_BOT_TOKEN with your Discord bot token from the Bot settings page.
Copy your "Client ID" from the OAuth2 tab and fill in DISCORD_CLIENT_ID.
Check that the installation worked: chmod +x go-chatgpt-discord && ./go-chatgpt-discord
Run the bot by executing ./go-chatgpt-discord. A bot invitation URL will appear in the console. Copy and paste this
URL into your web browser to add the bot to your server.
Enable direct messages from other members of your server by going to the "Privacy Settings" page of your server
and enabling "Allow direct messages from server members".
You're all set! You can now use the bot in your server by typing /chat in any channel, or by sending a direct
message to the bot.
Local Development
# build a go binary
$ make
# for local development
$ make run
# run unit tests
$ make test
Contributing
Welcome any kind of contribution to this repository. If you have any suggestions or ideas for improving the code
examples or best practices, please feel free to open an issue or submit a pull request.
License
Distributed under the MIT License. See LICENSE for more information.