Telegram Bot with ChatGPT and Golang
This is a Telegram bot created with ChatGPT and Golang. The bot uses OpenAI's GPT-3 language model to generate responses to user messages in real-time.
To build and run this application, you'll need to have the following software installed on your system:
- Generates human-like responses to user messages using ChatGPT API
- Persisting of user messages with sqlite
- Telegram support
- Built with Go for fast and efficient performance?
Before you can use the bot, you'll need to create a Telegram bot using the BotFather framework. Once you have created a bot and obtained an API token, you'll also need an API key from OpenAI
This is an example
TELEGRAM_API_KEY="" OPENAI_TOKEN="" RETAIN_HISTORY="false"
RETAIN_HISTORY="true" submits the previous conversations with the current text, see here, but when false, it only sends the prompt + the current users text, this reduces the amount of tokens been send per request.
prompt.txt or rename the example file
$ mv prompt.example.txt prompt.txt
the prompt helps you customize how the bot will react to messages
Example chat conversation
First, clone this repository to your local machine:
git clone github.com/navicstein/telechatgpt.git
Then, navigate to the project directory:
Finally, build the project:
go build -o /opt/telechatgpt
If you'd like to contribute to this project, please follow these steps:
- Fork this repository.
- Create a new branch (git checkout -b ).
- Make your changes and commit them (git commit -am "").
- Push to the branch (git push origin ).
- Create a new pull request
This project is licensed under the MIT License. See the LICENSE file for details