telechatgpt

command module
v0.0.0-...-74843cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2023 License: BSD-1-Clause Imports: 16 Imported by: 0

README

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.

Prerequisites

To build and run this application, you'll need to have the following software installed on your system:

  • Go

Features

  • 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 .env file

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.

create a 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

Example Image

Installing

First, clone this repository to your local machine:

git clone github.com/navicstein/telechatgpt.git

Then, navigate to the project directory:

cd telechatgpt

Finally, build the project:

go build -o /opt/telechatgpt

Contributing

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

License

This project is licensed under the MIT License. See the LICENSE file for details

Resources

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL