explaingit

father-bot/chatgpt_telegram_bot

5,499PythonAudience · developerComplexity · 2/5Setup · moderate

TLDR

A Telegram bot that lets you chat with OpenAI's GPT-4 models directly inside Telegram, with streaming replies, voice message transcription, 15 preset chat modes, and image generation via DALL-E.

Mindmap

mindmap
  root((repo))
    What it does
      Chat with GPT-4
      Stream replies live
      Transcribe voice notes
    Chat Modes
      15 presets
      Image generation
      Custom modes
    Setup
      Docker deploy
      OpenAI API key
      Telegram bot token
    Controls
      User allowlist
      Spending tracker
      Group chat support
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add an AI chatbot to a Telegram group chat so members can ask questions without leaving the app.

USE CASE 2

Build a personal AI assistant accessible from any phone with Telegram installed.

USE CASE 3

Create custom chat personas by editing the chat modes configuration file.

USE CASE 4

Track OpenAI API spending and restrict bot access to approved Telegram users only.

Tech stack

PythonDockerTelegram Bot APIOpenAI APIWhisper

Getting it running

Difficulty · moderate Time to first run · 30min

Requires an OpenAI API key and a Telegram bot token from BotFather before launching with Docker.

License not specified in the explanation, check the repository for terms.

In plain English

This project is a Python-based Telegram bot that lets users chat with OpenAI's language models directly inside the Telegram messaging app. Rather than opening a web browser to use ChatGPT, users can message the bot just like they would message a person on Telegram, and the bot responds using the OpenAI API. The bot supports GPT-4, GPT-4 Turbo, and GPT-4 Vision (for analyzing images), and delivers responses with message streaming, meaning the reply appears word by word as it's generated rather than all at once after a delay. Voice messages are also supported: record a voice note, and the bot transcribes it using OpenAI's Whisper service before generating a reply. One of the more distinctive features is a set of 15 pre-built chat modes that change how the AI responds. These include a general assistant, a coding helper, an image generator using DALL-E 2, a language tutor, and several personality personas. Users can switch between modes with a command, and additional modes can be created by editing a configuration file. The bot supports group chats, tracks spending against the OpenAI API balance, can restrict access to a list of approved Telegram users, and highlights code blocks in responses. Setup requires an OpenAI API key and a Telegram bot token from Telegram's BotFather service. Once those are in place, the bot is launched with Docker using two commands. The project is donation-supported by its community of users.

Copy-paste prompts

Prompt 1
I want to add a new chat mode to father-bot/chatgpt_telegram_bot that acts as a startup pitch coach. Here is the chat_modes.yml file: [paste file]. Write the new mode entry.
Prompt 2
I am deploying chatgpt_telegram_bot with Docker on a VPS. Write a docker-compose.yml that auto-restarts the bot on failure and loads secrets from an .env file.
Prompt 3
How do I restrict the Telegram bot in father-bot/chatgpt_telegram_bot to only respond to a specific list of user IDs?
Prompt 4
Help me add a new OpenAI model option to the bot config so users can switch between GPT-4 and GPT-4o from the Telegram menu.
Prompt 5
The voice message transcription in chatgpt_telegram_bot uses Whisper. How do I set the language so it always transcribes in Spanish?
Open on GitHub → Explain another repo

← father-bot on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.