Skip to content

Latest commit

 

History

History
35 lines (27 loc) · 1.39 KB

README.md

File metadata and controls

35 lines (27 loc) · 1.39 KB

GPT Telegram BOT

Simple Telegram bot connected to GPT

Requirements:

Install dependencies:

(Virtualenvs are highly recommended)

$ pip install -r requirements.txt

TELEGRAM

Set the Bot token as an environment variable

export TG_BOT_GPT_TOKEN=<bot_token>

GPT

export $OPENAI_API_KEY=<your_OPEN_AI_API_key>
  • File resources/example_config.json should be renamed to resources/config.json, and modified with the desired GPT engine configuration. In this file you can also modify the dialog lines (for greeting or other notifications that do not depend on GPT) and also, in this file, you can find the list of users that have access to this platform (allowed_users). If the user's identifier is not known, just start a conversation and a message with the id: User 'XXXXX' not allowed! will be automatically sent back to the user.
  • File resources/example_prompt.text should be renamed to resources/prompt.text, and modified with the initial prompt of the conversation.

Run

$ python gpt_telegram_bot.py

Telegram commands:

  • /start: For starting a conversation.
  • /cancel: For finalizing a conversation.