Interact with ChatGPT
English - 中文
Go CLI to fuels a Telegram bot that lets you interact with ChatGPT, a large language model trained by OpenAI.
Clone the repository and navigate into the folder.
git clone https://github.com/viper-00/chatgpt-telegram.git
cd chatgpt-telegram
Then, open the env.example
file with a text editor and fill in your credentials, including:
TELEGRAM_TOKEN
: Your Telegram Bot token.- Follow this guide to create a bot and obtain the token.
TELEGRAM_ID
(Optional): Your Telegram User ID- If you set this, only you will be able to interact with the bot.
- To get your ID, message
@userinfobot
on Telegram. - Multiple IDs can be provided, separated by commas.
EDIT_WAIT_SECONDS
(Optional): Amount of seconds to wait between edits- This is set to
1
by default, but you can increase if you start getting a lot ofToo Many Requests
errors.
- This is set to
- Save the file, and rename it to
.env
.
Note Make sure you rename the file to exactly
.env
! The program won't work otherwise.
Finally, open the terminal in your computer (if you're on Windows, look for PowerShell
), navigate to the directory where you saved the above file using the "cd" command, and run:
go run main.go -c chatgpt.json
or build and run:
go build -o chatgpt-telegram
./chatgpt-telegram -c chatgpt.json
The program use an API key
to authenticate your ChatGPT account information, so you need to generate a unique key on the offcial ChatGPT site in order to bind your account.
Note If you are not familiar with ChatGPT API keys, you can check the official site for more information.
After you enter the folder, open the chatgpt.json.example
file with a text editor and replace the 'your_chatgpt_api_key' text with your generated API key:
{ "openaiauthorization": "your_chatgpt_api_key" }
Save the file and rename it to chatgpt.json
.
This repository is licensed under the MIT License.