{"id":13815097,"url":"https://github.com/alexander-akhmetov/python-telegram","last_synced_at":"2025-05-14T10:06:58.656Z","repository":{"id":37852132,"uuid":"131349664","full_name":"alexander-akhmetov/python-telegram","owner":"alexander-akhmetov","description":"Python client for the Telegram's tdlib","archived":false,"fork":false,"pushed_at":"2025-04-03T18:48:21.000Z","size":110067,"stargazers_count":656,"open_issues_count":11,"forks_count":130,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-04-06T10:02:41.568Z","etag":null,"topics":["python","python-telegram","tdlib","tdlib-python","telegram","telegram-api","telegram-bot","telegram-bot-api","telegram-bots","telegram-cli"],"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/alexander-akhmetov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2018-04-27T22:16:07.000Z","updated_at":"2025-03-30T21:26:43.000Z","dependencies_parsed_at":"2024-01-03T13:34:40.546Z","dependency_job_id":"7331aa19-5402-4c69-8a99-fa83a44b4441","html_url":"https://github.com/alexander-akhmetov/python-telegram","commit_stats":{"total_commits":255,"total_committers":23,"mean_commits":11.08695652173913,"dds":0.7294117647058824,"last_synced_commit":"7b99b6dabf2cf896fd58227509c76bed638b4141"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexander-akhmetov%2Fpython-telegram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexander-akhmetov%2Fpython-telegram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexander-akhmetov%2Fpython-telegram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexander-akhmetov%2Fpython-telegram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexander-akhmetov","download_url":"https://codeload.github.com/alexander-akhmetov/python-telegram/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248717237,"owners_count":21150389,"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","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":["python","python-telegram","tdlib","tdlib-python","telegram","telegram-api","telegram-bot","telegram-bot-api","telegram-bots","telegram-cli"],"created_at":"2024-08-04T04:02:57.559Z","updated_at":"2025-04-13T13:12:37.831Z","avatar_url":"https://github.com/alexander-akhmetov.png","language":"Python","readme":"# python-telegram\n\n[![Build Status](https://github.com/alexander-akhmetov/python-telegram/workflows/python-telegram%20tests/badge.svg)](https://github.com/alexander-akhmetov/python-telegram/actions)\n[![PyPI](https://img.shields.io/pypi/v/python-telegram.svg)](https://pypi.python.org/pypi/python-telegram)\n[![DockerHub](https://img.shields.io/docker/automated/akhmetov/python-telegram.svg)](https://hub.docker.com/r/akhmetov/python-telegram/)\n![Read the Docs (version)](https://img.shields.io/readthedocs/pip/stable.svg)\n\nPython API for the [tdlib](https://github.com/tdlib/td) library.\nIt helps you build your own Telegram clients.\n\n- [Changelog](https://python-telegram.readthedocs.io/en/latest/changelog.html)\n- [Documentation](http://python-telegram.readthedocs.io)\n- [Tutorial](http://python-telegram.readthedocs.io/en/latest/tutorial.html)\n\n## Installation\n\nThis library requires Python 3.9+ and Linux or MacOS. Windows is not supported.\n\n```shell\npip install python-telegram\n```\n\nSee [documentation](http://python-telegram.readthedocs.io/en/latest/#installation) for more details.\n\n### tdlib\n\n`python-telegram` comes with a precompiled `tdlib` library for Linux and MacOS. But it is highly recommended to [compile](https://tdlib.github.io/td/build.html) it yourself.\nThe precompiled library may not work on some systems, it is dynamically linked and requires specific versions of additional libraries.\n\n```shell\n\n### Docker\n\nThis library has a [docker image](https://hub.docker.com/r/akhmetov/python-telegram/):\n\n```sh\ndocker run -i -t --rm \\\n            -v /tmp/docker-python-telegram/:/tmp/ \\\n            akhmetov/python-telegram \\\n            python3 /app/examples/send_message.py $(API_ID) $(API_HASH) $(PHONE) $(CHAT_ID) $(TEXT)\n```\n\n## How to use the library\n\nCheck out the [tutorial](http://python-telegram.readthedocs.io/en/latest/tutorial.html) for more details.\n\nBasic example:\n\n```python\nfrom telegram.client import Telegram\nfrom telegram.text import Spoiler\n\ntg = Telegram(\n    api_id='api_id',\n    api_hash='api_hash',\n    phone='+31611111111',  # you can pass 'bot_token' instead\n    database_encryption_key='changekey123',\n    files_directory='/tmp/.tdlib_files/',\n)\ntg.login()\n\n# If this is the first run, the library needs to preload all chats.\n# Otherwise, the message will not be sent.\nresult = tg.get_chats()\nresult.wait()\n\nchat_id: int\nresult = tg.send_message(chat_id, Spoiler('Hello world!'))\n\n# `tdlib` is asynchronous, so `python-telegram` always returns an `AsyncResult` object.\n# You can receive a result with the `wait` method of this object.\nresult.wait()\nprint(result.update)\n\ntg.stop()  # You must call `stop` at the end of the script.\n```\n\nYou can also use `call_method` to call any [tdlib method](https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_function.html):\n\n``` python\ntg.call_method('getUser',  params={'user_id': user_id})\n```\n\nMore examples can be found in the [/examples/ directory](/examples/).\n\n---\n\nMore information is available in the [documentation](http://python-telegram.readthedocs.io).\n\n## Development\n\nSee [CONTRIBUTING.md](/CONTRIBUTING.md).\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexander-akhmetov%2Fpython-telegram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexander-akhmetov%2Fpython-telegram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexander-akhmetov%2Fpython-telegram/lists"}