Categorygithub.com/kapitanov/gptbot
modulepackage
0.0.0-20241028220831-f7e2f166f3c5
Repository: https://github.com/kapitanov/gptbot.git
Documentation: pkg.go.dev

# README

gptbot

A telegram bot that uses GPT3 to transform text.

This bot is non-public, so you'll need to set up your own instance of this bot to use it.

How to build and run

  1. Clone git repository to any appropriate directory:

    cd /opt
    git clone https://github.com/kapitanov/gptbot.git
    cd gptbot
    
  2. Create a .env file (see configuration section below):

    TELEGRAM_BOT_TOKEN=<telegram access token>
    TELEGRAM_BOT_ACCESS=<list of comma-separated telegram user ids and names>
    OPENAI_TOKEN=<place your openai token here>
    STORAGE_PATH=./var/data.yaml
    

    You'll need to:

    • get an access token for openai.com here
    • get a bot api token for Telegram here
  3. Build and run docker container:

    docker-compose up -d --build
    

Configuration

This bot is configured via env variables:

VariableDefaultDescription
TELEGRAM_BOT_TOKENRequiredTelegram bot API access token
TELEGRAM_BOT_ACCESSRequiredList of allowed Telegram usernames (or userIDs), comma separated
OPENAI_TOKENRequiredOpenAI access token
STORAGE_PATHRequiredPath to message history file (YAML)

License

MIT

# Functions

NewAccessProvider creates new access provider.

# Structs

AccessProvider checks access to telegram chats.