Simple Telegram bot connected to GPT
(Virtualenvs are highly recommended)
$ pip install -r requirements.txtSet the Bot token as an environment variable
export TG_BOT_GPT_TOKEN=<bot_token>- OpenAI account, and access to an api key. That key should be exported as an environment variable:
export $OPENAI_API_KEY=<your_OPEN_AI_API_key>- File
resources/example_config.jsonshould be renamed toresources/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.textshould be renamed toresources/prompt.text, and modified with the initial prompt of the conversation.
$ python gpt_telegram_bot.pyTelegram commands:
/start: For starting a conversation./cancel: For finalizing a conversation.