Skip to content

Your self-hosted telegram bot for chatting with ChatGPT

License

Notifications You must be signed in to change notification settings

clemsau/telegram-gpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

telegram-gpt

Your self-hosted telegram bot for chatting with ChatGPT.

Features

  • GPT-3.5 chatbot.
  • Handle voice messages
  • Toggleable answer on mentions, for a better integration in group chats.
Demo gif

Installation

  1. 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:

    1. 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.

    2. 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"
  2. Install the requirements

    pip install -r requirements.txt

Usage

Run the bot

```bash
python src/bot.py
```

Deployment

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).

Contributing

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.

License

MIT

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

About

Your self-hosted telegram bot for chatting with ChatGPT

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published