{"id":23431993,"url":"https://github.com/zzh1996/chatgpt-telegram-bot","last_synced_at":"2025-09-01T20:36:43.285Z","repository":{"id":157221124,"uuid":"608389477","full_name":"zzh1996/chatgpt-telegram-bot","owner":"zzh1996","description":"ChatGPT Telegram bot","archived":false,"fork":false,"pushed_at":"2025-08-26T16:08:35.000Z","size":343,"stargazers_count":51,"open_issues_count":1,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-31T14:59:49.090Z","etag":null,"topics":["chatgpt","claude-3","gemini-pro","gpt","gpt-3","gpt-4","openai","openai-api","telegram","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zzh1996.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-03-01T23:09:32.000Z","updated_at":"2025-08-07T12:28:12.000Z","dependencies_parsed_at":"2023-12-09T20:32:33.581Z","dependency_job_id":"31fb8059-6b71-4d41-9064-b4c314f385b5","html_url":"https://github.com/zzh1996/chatgpt-telegram-bot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zzh1996/chatgpt-telegram-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzh1996%2Fchatgpt-telegram-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzh1996%2Fchatgpt-telegram-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzh1996%2Fchatgpt-telegram-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzh1996%2Fchatgpt-telegram-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zzh1996","download_url":"https://codeload.github.com/zzh1996/chatgpt-telegram-bot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzh1996%2Fchatgpt-telegram-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273186785,"owners_count":25060516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt","claude-3","gemini-pro","gpt","gpt-3","gpt-4","openai","openai-api","telegram","telegram-bot"],"created_at":"2024-12-23T10:52:16.430Z","updated_at":"2025-09-01T20:36:43.238Z","avatar_url":"https://github.com/zzh1996.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chatgpt-telegram-bot\n\n![Demo](https://user-images.githubusercontent.com/10773481/235257879-ce91d3d3-769a-4089-addd-2ac9eea26f35.gif)\n\n## Branches\n\n- **master** - The OpenAI GPT models. Stable version.\n- **dev** - The OpenAI GPT models. Development version.\n- **system-prompt** - The OpenAI GPT models. Allows users to specify a system prompt arbitrarily.\n- **gemini** - The Google Gemini models.\n- **claude** - The Anthropic Claude models.\n- **glm** - The Zhipu AI GLM-4 models.\n- **gpts** - Allows customization of different prefixes corresponding to different system prompts, similar to ChatGPT's GPTs functionality.\n- **plugins** - Utilizes the Function calling feature of GPT-4 to support Google and Bing searches, web browsing, YouTube subtitle downloads, Wolfram Alpha, and a calculator plugin.\n\n## Features\n\n1. **Real-time output streaming** - Receive AI model outputs while they are being generated using the message editing feature of Telegram.\n1. **Model switching** - Easily change between models (e.g., GPT-4 and GPT-3.5-Turbo) using distinct message prefixes.\n1. **Concurrent requests** - The bot can process multiple user queries simultaneously.\n1. **Long message support** - For outputs exceeding Telegram's single message limit, the bot replies using multiple messages.\n1. **Automatic retry** - The bot retries automatically in case of OpenAI API or Telegram API errors.\n1. **Persistent and forkable chat history** - Chat logs are stored in a database, allowing users to reply to historical messages anytime.\n1. **Message queueing** - Replies to generating messages are added to a processing queue.\n1. **Whitelist management** - Bot administrators can enable or disable the bot in specific groups.\n1. **Multimodal Support** - Supports images and text files as input.\n1. **Rich Text Rendering** - The bot's output can be displayed as rich text in Telegram, such as code blocks and bold text.\n\n## Usage\n\n1. Obtain an OpenAI API key from https://platform.openai.com/account/api-keys\n1. Create a Telegram bot by using BotFather via https://t.me/BotFather\n1. Get `api_id` and `api_hash` from https://my.telegram.org/apps\n1. Set **OpenAI API key** and **Telegram Bot Token** and **Telegram API ID and Hash** in the `docker-compose.yml` file.\n1. In the `main.py` file, specify the **Telegram admin user ID** (you can send `/ping` to your bot to obtain your user ID) and the **prompt text**.\n1. If you want to use the bot in a group, you must **disable privacy mode** in the bot settings.\n1. Run `docker-compose up --build -d`\n1. You can interact with your bot by initiating a new conversation with a message that starts with `$`. For example, you can type `$Hello`. By default, the bot uses the GPT-4 model. To switch to the GPT-3.5-Turbo model, simply start the message with `$$`.\n1. To continue a conversation thread, reply to a previous message sent by the bot.\n1. You can reply multiple times to the same message to \"fork\" the thread.\n1. In a group, only the bot admin can use the `/add_whitelist` command to whitelist the group. To remove the group from the whitelist, the admin can use the `/del_whitelist` command.\n1. Finally, in a private chat with the bot, you can use the `/get_whitelist` command to get a list of all whitelisted groups.\n\nBy following these steps, you can effectively use the ChatGPT Telegram bot for your needs.\n\nNote: the above instructions are written by ChatGPT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzh1996%2Fchatgpt-telegram-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzzh1996%2Fchatgpt-telegram-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzh1996%2Fchatgpt-telegram-bot/lists"}