{"id":42470995,"url":"https://github.com/micl2e2/tg-focus","last_synced_at":"2026-01-28T09:48:39.208Z","repository":{"id":188274549,"uuid":"678039496","full_name":"micl2e2/tg-focus","owner":"micl2e2","description":"A reliable Telegram message filter/forwarder that helps you focus💡.","archived":false,"fork":false,"pushed_at":"2025-11-29T12:49:05.000Z","size":7499,"stargazers_count":126,"open_issues_count":15,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-01T14:37:48.748Z","etag":null,"topics":["c-plus-plus-20","message-forwarding","tdlib","telegram","telegram-api","telegram-bot","telegram-bot-api","telegram-chat","telegram-filter","telegram-forwarder","telegram-message-sender","telegram-userbot","tg-bot","tg-forwarder","userbot"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micl2e2.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-GPL","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":null,"patreon":"micl2e2/shop","open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"custom":null}},"created_at":"2023-08-13T13:40:36.000Z","updated_at":"2025-11-29T12:49:08.000Z","dependencies_parsed_at":"2024-04-22T17:04:28.879Z","dependency_job_id":"c6588b8a-738b-402d-8738-c019cccd1470","html_url":"https://github.com/micl2e2/tg-focus","commit_stats":null,"previous_names":["micl2e2/tg-focus"],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/micl2e2/tg-focus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micl2e2%2Ftg-focus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micl2e2%2Ftg-focus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micl2e2%2Ftg-focus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micl2e2%2Ftg-focus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micl2e2","download_url":"https://codeload.github.com/micl2e2/tg-focus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micl2e2%2Ftg-focus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28844011,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T07:39:25.367Z","status":"ssl_error","status_checked_at":"2026-01-28T07:39:24.487Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["c-plus-plus-20","message-forwarding","tdlib","telegram","telegram-api","telegram-bot","telegram-bot-api","telegram-chat","telegram-filter","telegram-forwarder","telegram-message-sender","telegram-userbot","tg-bot","tg-forwarder","userbot"],"created_at":"2026-01-28T09:48:38.119Z","updated_at":"2026-01-28T09:48:39.188Z","avatar_url":"https://github.com/micl2e2.png","language":"C++","readme":"\n# Table of Contents\n\n-   [TG-Focus💡](#org1dfb543)\n-   [Quickstart](#orgb72c48b)\n-   [TGFCMD Examples](#orgac31100)\n-   [Filters Rules](#org0a24161)\n-   [Contributing](#org88b1558)\n-   [FAQ](#org633d011)\n-   [License](#org8a57fb7)\n\n\n\n\u003ca id=\"org1dfb543\"\u003e\u003c/a\u003e\n\n# TG-Focus💡\n\n\u003ca href=\"\u003chttps://github.com/micl2e2/tg-focus/blob/master/LICENSE-GPL\u003e\"\u003e![GitHub License](\u003chttps://img.shields.io/github/license/micl2e2/tg-focus?logo=gnu\u0026color=blue\u0026link=https%3A%2F%2Fgithub.com%2Fmicl2e2%2Ftg-focus%2Fblob%2Fmaster%2FLICENSE-GPL\u003e)\u003c/a\u003e\n\u003ca href=\"\u003chttps://core.telegram.org/tdlib\u003e\"\u003e![Static Badge](\u003chttps://img.shields.io/badge/tdlib-1.8.50-%2332a9de\u003e)\u003c/a\u003e\n\u003ca href=\"\u003chttps://github.com/tdlib/td\u003e\"\u003e![GitHub commits difference between two branches/tags/commits](\u003chttps://img.shields.io/github/commits-difference/tdlib/td?base=0857d7e909418c3c3b51a38abe3336b9f32c41fd\u0026head=master\u0026logo=gitextensions\u0026label=pending\u0026color=lightblue\u0026link=https%3A%2F%2Fgithub.com%2Ftdlib%2Ftd\u003e)\u003c/a\u003e\n\ntg-focus is a reliable \u003cb\u003eT\u003c/b\u003eele\u003cb\u003eg\u003c/b\u003eram message filter/forwarder that helps\nyou **focus**. A gentle user bot for message forwarding. Most of message\ntypes are supported: public/private chats, channel updates, and more.\n\nWith [TGFCMD](#usingtgfcmd), you have full control of the messages you'd see in a dedicated chat **TG-FOCUS**.\n\nBeing built on top of [TDLib](https://core.telegram.org/tdlib/) directly, tg-focus is inherently as\nconsistent, reliable and stable as TDLib itself for most\nTelegram-specific features. \n\nThe supported platforms are:\n\n\u003ctable border=\"2\" cellspacing=\"0\" cellpadding=\"6\" rules=\"groups\" frame=\"hsides\"\u003e\n\n\n\u003ccolgroup\u003e\n\u003ccol  class=\"org-left\" /\u003e\n\n\u003ccol  class=\"org-left\" /\u003e\n\n\u003ccol  class=\"org-left\" /\u003e\n\u003c/colgroup\u003e\n\u003cthead\u003e\n\u003ctr\u003e\n\u003cth scope=\"col\" class=\"org-left\"\u003eOS \\ ARCH\u003c/th\u003e\n\u003cth scope=\"col\" class=\"org-left\"\u003ex86 64\u003c/th\u003e\n\u003cth scope=\"col\" class=\"org-left\"\u003eaarch64\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd class=\"org-left\"\u003eLinux\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e✅\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\n\n\u003ctr\u003e\n\u003ctd class=\"org-left\"\u003eWindows \u003ca href=\"https://learn.microsoft.com/en-us/windows/wsl/install\"\u003eWSL\u003c/a\u003e\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e✅\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e✅\u003c/td\u003e\n\u003c/tr\u003e\n\n\n\u003ctr\u003e\n\u003ctd class=\"org-left\"\u003emacOS \u003ca href=\"https://github.com/apple/container?tab=readme-ov-file#get-started\"\u003eContainerization\u003c/a\u003e\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e🔨\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e🔨\u003c/td\u003e\n\u003c/tr\u003e\n\n\n\u003ctr\u003e\n\u003ctd class=\"org-left\"\u003eWindows\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e🔨\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e🔨\u003c/td\u003e\n\u003c/tr\u003e\n\n\n\u003ctr\u003e\n\u003ctd class=\"org-left\"\u003eBSD\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e🔨\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e🔨\u003c/td\u003e\n\u003c/tr\u003e\n\n\n\u003ctr\u003e\n\u003ctd class=\"org-left\"\u003emacOS\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e🔨\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e🔨\u003c/td\u003e\n\u003c/tr\u003e\n\n\n\u003ctr\u003e\n\u003ctd class=\"org-left\"\u003e\u0026#xa0;\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e\u0026#xa0;\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003e\u0026#xa0;\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\nSupported(✅). Work In Progress(🔨). \n\n\n## Overhead\n\nIn case someone cares about the overhead, here is a rough overview,\nrandomly captured after **~2 months** of uninterrupted running on a **1C 1G**\nmachine: With **~500K** messages being filtered, it occupied **\u003c1%** of\nCPU and **\u003c40%** of memory (TDLib included).  \n\n\n\u003ca id=\"orgb72c48b\"\u003e\u003c/a\u003e\n\n# Quickstart\n\nYou can use [Docker](#usingdocker) or [executable binaries](#usingbinaries) to get started.\n\n\n\u003ca id=\"usingdocker\"\u003e\u003c/a\u003e\n\n## Using Docker/Podman\n\nThe following 5 steps will help you run tg-focus and filter some\nspecific messages.\n\n1.  Download the images:\n    \n        docker pull micl2e2/tg-focus\n    \n    or\n    \n        # if you use Podman rather than Docker\n        podman pull docker.io/micl2e2/tg-focus\n        \n        # If you have trouble in reaching Docker Hub, try GitHub Package:\n        docker pull ghcr.io/micl2e2/tg-focus\n        # or\n        podman pull ghcr.io/micl2e2/tg-focus\n\n2.  Run tg-focus:\n    \n        docker run -d --name tgfocus micl2e2/tg-focus\n\n3.  Log in your Telegram account:\n    \n        docker exec -i tgfocus auth\n        \n        # Enter phone number: +1 23 4567\n        # Enter login code: xxxxxx\n    \n    *note: phone number in international format `+1 23 4567` if your\n    number is `23 4567` with region code `+1` (spaces are allowed).*\n    \n    If everthing works fine, you should see:\n    \n    \u003e Logged in!\n    \n    You can check more details about tg-focus by `docker exec -i tgfocus status`.\n\n4.  Go back to your Telgram application, wait for the TG-FOCUS\n    group showing up. *(usually takes up 1~2 mins, depends on your\n    network connection)* \n    \n    \u003e If TG-FOCUS group doesn't appear, send a message \"tg-focus\" in a\n    \u003e random group(e.g. Saved Messages). *This is because by default, only\n    \u003e messages contain \"tg-focus\" will be filtered and forwarded.*\n    \n    \u003e If TG-FOCUS group doesn't appear after a long wait(e.g. 10 mins),\n    \u003e run a command `./tgfocus status`, report and open a GitHub issue\n    \u003e with the command output attached.\n\n5.  Once the group shown up, you send a message `TGFCMD help` to get\n    started. Check [TGFCMD](#usingtgfcmd) for more details.\n\n\n\u003ca id=\"usingbinaries\"\u003e\u003c/a\u003e\n\n## Using Binaries\n\nThe following 6 steps will help you run tg-focus and filter some\nspecific messages.\n\n1.  Download the binaries at GitHub releases [page](https://github.com/micl2e2/tg-focus/releases).\n\n2.  Extract the files:\n    \n        # linux \n        tar xf tg-focus-3.0-linux-x86_64.tar.gz\n        cd tg-focus-3.0-linux-x86_64\n\n3.  Log in your Telegram account:\n    \n        ./tgfocus auth\n        \n        # Enter phone number: +1 23 4567\n        # Enter login code: xxxxxx\n    \n    *note: phone number in international format `+1 23 4567` if your\n    number is `23 4567` with region code `+1` (spaces are allowed).*\n    \n    If everthing works fine, you should see:\n    \n    \u003e Logged in!\n\n4.  Start up tg-focus daemon:\n    \n        ./tgfocus quickstart\n    \n    *note: conversely, use `./tgfocus shutdown` to shutdown tg-focus*\n    \n    If everthing works fine, you should see:\n    \n    \u003e startup: done\n    \u003e \n    \u003e focus-start: done\n\n5.  Go back to your Telgram application, wait for the TG-FOCUS\n    group showing up. *(usually takes up 1~2 mins, depends on your\n    network connection)* \n    \n    \u003e If TG-FOCUS group doesn't appear, send a message \"tg-focus\" in a\n    \u003e random group(e.g. Saved Messages). *This is because by default, only\n    \u003e messages contain \"tg-focus\" will be filtered and forwarded.*\n    \n    \u003e If TG-FOCUS group doesn't appear after a long wait(e.g. 10 mins),\n    \u003e run a command `./tgfocus status`, report and open a GitHub issue\n    \u003e with the command output attached.\n\n6.  Once the group shown up, you send a message `TGFCMD help` to get\n    started. Check [TGFCMD](#usingtgfcmd) for more details.\n\n\n\u003ca id=\"usingtgfcmd\"\u003e\u003c/a\u003e\n\n## Using TGFCMD\n\nSay there is a Telegram user, called Bob. He owns\na group. Every day, plenty of messages are sending out in that\ngroup, it is too overwhelming, Bob wants to focus on the\nmessages that strongly interest him, he decides to use\ntg-focus. After the previous 6-step setup, he now is going to use\nTGFCMD to configure his tg-focus to forward the messages he is\nstrongly interested in:\n\n\u003cimg src=\"docs/imgtuto/tuto1.png\" width=\"500px\"/\u003e\u003cbr/\u003e\n\u003cimg src=\"docs/imgtuto/tuto2.png\" width=\"800px\"/\u003e\u003cbr/\u003e\n\u003cimg src=\"docs/imgtuto/tuto3.png\" width=\"500px\"/\u003e\u003cbr/\u003e\n\u003cimg src=\"docs/imgtuto/tuto4.png\" width=\"550px\"/\u003e\u003cbr/\u003e\n\u003cimg src=\"docs/imgtuto/tuto5.png\" width=\"700px\"/\u003e\u003cbr/\u003e\n\u003cimg src=\"docs/imgtuto/tuto6.png\" width=\"600px\"/\u003e\u003cbr/\u003e\n\u003cimg src=\"docs/imgtuto/tuto7.png\" width=\"550px\"/\u003e\u003cbr/\u003e\n\n\n\u003ca id=\"orgac31100\"\u003e\u003c/a\u003e\n\n# TGFCMD Examples\n\n*Note that TGFCMD commands are to be sent out in the TG-FOCUS group*\n\nTo forward the messages that belong to the chat \"Freedom User Group\":\n\n    TGFCMD filter.edit 1 titles add \"Freedom User Group\"\n\nTo forward the messages that sent by the user \"Some One\":\n\n    TGFCMD filter.edit 1 senders add \"Some One\"\n\nTo forward the messages that contain a word \"freedom\":\n\n    TGFCMD filter.edit 1 keywords add \"freedom\"  \n\nTo forward two types of messages, the first contains a word \"free\nthings\" and belongs to the chat \"Nonfree Lovers\", the second contains\na word \"nonfree things\" and belongs to \"Free Lovers\":\n\n    TGFCMD filter.edit 1 titles add \"Nonfree Lovers\"\n    TGFCMD filter.edit 1 keywords add \"free things\"\n    TGFCMD filter.edit 2 titles add \"Free Lovers\"\n    TGFCMD filter.edit 2 keywords add \"nonfree things\"\n\nNot to forward the messages that sent by the user \"Nonfree Lover\":\n\n    TGFCMD filter.edit 1 no-senders add \"Nonfree Lover\"\n\nCheck current filters configuration:\n\n    TGFCMD filters\n\nPause forwarding:\n\n    TGFCMD pause\n\nResume forwarding:\n\n    TGFCMD resume\n\n\n\u003ca id=\"org0a24161\"\u003e\u003c/a\u003e\n\n# Filters Rules\n\nFilters configurationa is composed of many *Focus Filters*. A *Focus\nFilter* is a filter to match against the message's \nchat/sender/content. They have several rules(or properties):\n\n-   *titles*\n-   *keywords*\n-   *senders*\n-   *no-titles*\n-   *no-senders*\n-   *no-keywords*\n\nSimply put, *titles*, *keywords*, *senders* are the lists of\nchat titles, keywords, senders that you are interested in respectively.\n*no-titles*, *no-keywords*, *no-senders* are the ones you don't want\nto see.\n\nUsers can add values to those rules as many as they like, they\naccept ****simple text**** or ****regular expression****, as well as filters.\n\nWhen a message comes, filters are tried one by one, if there is any\nfilter than can **match** the message and not **reject** it, it\nwill be forwarded to TG-FOCUS chat. \n\nA focus filter **matches** the message if it matches any filter's:\n\n-   *titles* and\n-   *senders* and\n-   *keywords*\n\nNote that an empty rule(i.e., you haven't configure it) matches\neverthing.\n\nIf a focus filter  fails to match the incoming message, the next focus\nfilter will be tried. If all focus filters fail to match it, the\nmessage will be discarded.\n\nA focus filter **rejects** the message if it matches any filter's:\n\n-   *no-title* or\n-   *no senders* or\n-   *no-keywords*\n\nNote thta if any focus filter rejects the message, the next focus\nfilter will not be tried, and the message will be discarded.\n\n(You can think of the first three rules as *whitelist*,\nthe last three rules as *blacklist*)\n\n\n\u003ca id=\"org88b1558\"\u003e\u003c/a\u003e\n\n# Contributing\n\ntg-focus is still far from perfect, any form of contribution is\nwelcomed:\n\n-   Ask question (open an issue with label \"question\")\n-   Bug Report (open an issue with label \"bug\")\n-   Feature Request (open an issue with label \"enhancement\")\n-   Documentation Improvement\n-   Code Contribution (tg-focus follows [GCC](\u003chttps://gcc.gnu.org/\u003e) code\n    style)\n\n\n## ToDo list\n\nThis is a list of TODOs that are certainly to be finished in the near\nfuture, you can pick one then get started if you are interested in:\n\n-   [ ] Project Logo (also used as TG-FOCUS group avatar)\n-   [ ] Forwarded message's Look\n-   [ ] Configuration in JSON Format\n-   [ ] Windows Port\n-   [ ] BSD Port\n-   [ ] macOS Port\n-   [ ] More C++20/23/26 features\n-   [ ] More different build systems\n\n\n## Development\n\n\n### Linux\n\nDistribution:\n\n-   Debian 11 (Bullseye)\n    -   *note: bullseye-like distros might work, but it won't be\n        considered an issue if not working there.*\n\nSoftware:\n\n-   bash, git, sudo, apt, etc.\n    -   run `bash ci/prep-libs-deb11-x86_64.bash` to automatically\n        prepare them.\n-   custom built GCC\n    -   run `bash ci/prep-toolc-deb11-x86_64.bash` to automatically\n        prepare them.\n\nBuilding:\n\n-   run `bash ci/build-tgfocus-deb11-x86_64.bash` to get a Release\n    build.\n-   run `DDD=1 bash ci/build-tgfocus-deb11-x86_64.bash` to get a Debug\n    build.\n\n\n\u003ca id=\"org633d011\"\u003e\u003c/a\u003e\n\n# FAQ\n\n\n## Why yet another Telegram message forwarder?\n\nThere are already many TG message forwarders over there, and some of\nthem have been continuously developed for a long time. I do think most\nof them are doing a great job. However what I was looking for was a\nmessage forwarder with a combination of stability, reliability,\ntransparency, and flexibility, none of them could completely meet my\npersonal preference, at least in the days before this project\nstarted.\n\n\n## Can I trust tg-focus?\n\nYes.\n\nFirst of all, consider that tg-focus is a GPL-licensed [free\nsoftware](\u003chttps://www.gnu.org/philosophy/free-sw.en.html\u003e). As for\nprivacy, only credentials necessary for tdlib initialization are saved\non the user's machine. And they are completely *yours-irrelavent*. As\nfor source code, tg-focus's source as well as its dependencies' source\nare completely open.\n\nAnd one more step we take is that, all of released binaries are built\nby **not** any individual, but **Github-hosted** machines.\nCheck [github actions](https://github.com/micl2e2/tg-focus/actions) for more details.\n\n\n\u003ca id=\"org8a57fb7\"\u003e\u003c/a\u003e\n\n# License\n\ntg-focus is licensed under *GNU General Public License Version\n3.0*. There is NO WARRANTY, to the extent permitted by law.\n\n","funding_links":["https://patreon.com/micl2e2/shop"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicl2e2%2Ftg-focus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicl2e2%2Ftg-focus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicl2e2%2Ftg-focus/lists"}