Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 2.22 KB

README.md

File metadata and controls

37 lines (28 loc) · 2.22 KB

GitHub go.mod Go version of a Go module GitHub license Github all releases GitHub release GitHub forks GitHub issues

Simply Telegram bot on Golang and ChatGPT

Disclaimer

This is a simple, test program written for educational purposes. If something goes wrong - the author does not bear any responsibility.

This Telegram bot works on the principle of long polling, for real use it is better to switch to using a webhook.

Install

Just a few simple steps:

  1. Clone repository
  2. Rename file config.yaml.example to config.yaml and set up your tokens (chatGPT and Telegram) in file
  3. Setup external Golang packages (run this command in cloned project folder)
go get github.com/sashabaranov/go-gpt3
go get github.com/go-telegram-bot-api/telegram-bot-api
go get github.com/spf13/viper
  1. Then run with "go run" or compile the binary

Usage

To send a ChatGPT request, send a command to the bot starting with /cg (can be changed in the aap.go file) followed by your question with a space. For example:

/cg What is Golang?

Remember that the request takes some time, so the answer will not come immediately. Typically within 10 seconds. If for some reason the request to ChatGPT cannot be completed, the bot will send back the phrase:

ChatGPT API error

Happy using! ;-)