Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
n3d1117 committed Dec 5, 2022
1 parent e4ba2c9 commit a10d6ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
OPENAI_EMAIL="<YOUR_OPENAI_EMAIL>"
OPENAI_PASSWORD="YOUR_OPENAI_PASSWORD"
TELEGRAM_BOT_TOKEN="YOUR_TELEGRAM_BOT_TOKEN"
OPENAI_PASSWORD="<YOUR_OPENAI_PASSWORD>"
TELEGRAM_BOT_TOKEN="<YOUR_TELEGRAM_BOT_TOKEN>"
25 changes: 9 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ A [Telegram bot](https://core.telegram.org/bots/api) that integrates with OpenAI
<img width="600" alt="Demo" src="https://user-images.githubusercontent.com/11541888/205508077-c6fa9c30-242e-4605-81a6-1049ca0060f3.png">

## 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

Expand All @@ -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": "<YOUR_OPENAI_SESSION_TOKEN>",
"telegram_bot_token": "<YOUR_TELEGRAM_BOT_TOKEN>"
}
OPENAI_EMAIL="<YOUR_OPENAI_EMAIL>"
OPENAI_PASSWORD="<YOUR_OPENAI_PASSWORD>"
TELEGRAM_BOT_TOKEN="<YOUR_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 <YOUR_OPENAI_EMAIL> <YOUR_OPENAI_PASSWORD>
```
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:
Expand Down

0 comments on commit a10d6ce

Please sign in to comment.