Your self-hosted telegram bot for chatting with ChatGPT.
- GPT-3.5 chatbot.
- Handle voice messages
- Toggleable answer on mentions, for a better integration in group chats.
-
Set your environment variables
⚠ Note that
ALLOWED_USERS
is for the user IDs and not the usernames. To get your user ID, you can use @userinfobot on telegram.You have multiple options:
-
create a
.env
file in the/src
folder with the following content:TELEGRAM_TOKEN="your_telegram_token" OPENAI_API_KEY="your_openai_api_key" ALLOWED_USERS="allowed_user1,allowed_user2"
You can also fill the
.env.example
file and rename it to.env
. -
set the environment variables in your shell:
export OPENAI_API_KEY="your_telegram_token" export TELEGRAM_TOKEN="your_openai_api_key" export ALLOWED_USERS="allowed_user1,allowed_user2"
-
-
Install the requirements
pip install -r requirements.txt
Run the bot
```bash
python src/bot.py
```
You have multiple solutions to deploy this bot. The simplest solution is to run it on a bare metal server. Since this application run on very low resources, you can run it on a raspberry pi or a small vps (e.g: Digital Ocean 4$/month droplet).
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change
Try to be as descriptive as possible when opening an issue.
Chatting with ChatGPT through the web interface is sometimes frustrating. Plus, I found myself using it way more since I can just send it a quick text from my phone now, or even a voice message that will be transcribed.
I highly recommend everyone to try it for a few days, it's great for when you have questions on the fly, just open your phone and say what you need to know. The API cost is surprisingly low, I paid approximately 0.50$ in one month of use.
I contributed in another project like this one, but it was meant to be creat bot for many users, and since using your OpenAI cost money, I think a simpler project for personal use is better.
Looking forward for feedbacks, and I will take in consideration any feature request.
GitHub repo