- Message the Telegram bot father, create a new bot, remember the bot token
- create a new group and add you bot as admin
- send a message in the group
https://api.telegram.org/bot<YourBOTToken>/getUpdates
insert your bot token in this url and paste it in your browser- search for the message, that you sent in the group, find and remember the chatid this message belongs to
- chatid = request["results"][]["message"]["chat"]["id"]
- Go to
https://beta.openai.com/account/api-keys
, login, create and remember your api key, remember you organization identifier - create a config.yml that looks like that, enter your data
open_ai:
api_key: <your api key>
organization: <your organziation identifier> # feel free to choose another model, if you want
model: "text-davinci-003" # determines the maximimum answer length, the bigger this number is the faster your free apikey trial is over
max_tokens_per_request: 100
telegram:
bot_key: <your bot key>
chat_id: <your chat id> # the smaller the interval the faster you will get a response, but also the more processing power is required over time
polling_interval_in_seconds: 3
- Host the script: Suggestion pythonanywhere.com (free), go on their website, create a free account
- From the Pythonanwhere dashboard go to "File" (top right) and upload the run.py file as well as the config.yml
- Create a new Bash Console and run the commands
pip3 install openai
andpip3 install pyyaml
, if you uploaded the requirements.txt you can also runpip install -r requirements.txt
- start the script by running
python run.py
, done, your bot should work now