diff --git a/.env.example b/.env.example index f1decffb..d4142933 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,3 @@ OPENAI_EMAIL="" -OPENAI_PASSWORD="YOUR_OPENAI_PASSWORD" -TELEGRAM_BOT_TOKEN="YOUR_TELEGRAM_BOT_TOKEN" \ No newline at end of file +OPENAI_PASSWORD="" +TELEGRAM_BOT_TOKEN="" \ No newline at end of file diff --git a/README.md b/README.md index 2834bcad..6da4b724 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,10 @@ A [Telegram bot](https://core.telegram.org/bots/api) that integrates with OpenAI Demo ## Prerequisites +- Python 3.10+ - [Pipenv](https://pipenv.readthedocs.io/en/latest/) - A [Telegram bot](https://core.telegram.org/bots#6-botfather) and its token -- Your [OpenAI](https://openai.com) session token (see [configuration](#configuration) section) +- An [OpenAI](https://openai.com) account (see [configuration](#configuration) section) ## Getting started @@ -24,34 +25,26 @@ cd chatgpt-telegram-bot ``` 2. Create a new virtual environment with Pipenv and install the required dependencies: - ``` pipenv install ``` 3. Activate the virtual environment: - ``` pipenv shell ``` ### Configuration -Customize the configuration by copying `config.json.example` and renaming it to `config.json`, then editing the settings as desired. +Customize the configuration by copying `.env.example` and renaming it to `.env`, then editing the settings as desired. ``` -{ - "openai_session_token": "", - "telegram_bot_token": "" -} +OPENAI_EMAIL="" +OPENAI_PASSWORD="" +TELEGRAM_BOT_TOKEN="" ``` You'll need to provide: -1. Your OpenAI session token (this is only sent to the OpenAI server to periodically refresh the access token and never shared), which expires after 1 month - - You can find this token in your browser's cookies (named `__Secure-next-auth.session-token`) after logging in to https://chat.openai.com/chat - - Alternatively, run the following code: - ```shell - pip install playwright - python openai_extract_session_token.py - ``` -2. Your Telegram bot's token, obtained using [BotFather](http://t.me/botfather) +1. Your OpenAI credentials (these are only sent to the OpenAI server to periodically refresh the access token and never shared) + - Read more [here](https://github.com/acheong08/ChatGPT) +2. Your Telegram bot's token, obtained using [BotFather](http://t.me/botfather) (see [tutorial](https://core.telegram.org/bots/tutorial#obtain-your-bot-token)) ### Run the project Use the following command to run the project: