ChatGPT的机器人
在 telegram创建基于 OpenAI Chat API 的机器人
github : https://github.com/PromiseChan/telegram_openai_chatbot
HOW TO QUICKLY BUILD YOUR OWN TELEGRAM CHAT BOT WITH OPENAI
1. apply for telegram bot api key
2. apply for openai api key
3. install python
4. pip install python-telegram-bot,requests,pyinstaller
5. modify the code
- replace the “TELEGRAM_BOT_TOKEN”,”CHAT_API_KEY” with yours
OR
- export TELEGRAM_BOT_TOKEN,CHAT_API_KEY to OS environment variables
6. package to executable file
check if the pyinstaller is installed, if not, install it first
1 | pip install pyinstaller |
then run the package script
1 | sh package.sh |
the executable file will be generated in the dist folder
7. deplop and run
upload the dist binary file (for example,telegramOpenAIChatbot) to your server, and run the bot
with the following script
1 | sh deploy.sh |