{"id":13826527,"url":"https://github.com/luckydonald/pytgbot","last_synced_at":"2025-10-08T18:13:27.209Z","repository":{"id":34161499,"uuid":"38005008","full_name":"luckydonald/pytgbot","owner":"luckydonald","description":"python module to access the telegram bot api.","archived":false,"fork":false,"pushed_at":"2024-02-16T09:59:54.000Z","size":8840,"stargazers_count":66,"open_issues_count":4,"forks_count":16,"subscribers_count":8,"default_branch":"release","last_synced_at":"2024-12-09T14:52:48.214Z","etag":null,"topics":["bot","pytgbot","python","python-3","python3","python34","python35","python36","pythonic","telegram","telegram-bot-api"],"latest_commit_sha":null,"homepage":null,"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/luckydonald.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2015-06-24T18:59:44.000Z","updated_at":"2024-07-06T18:20:06.000Z","dependencies_parsed_at":"2022-08-29T00:10:35.822Z","dependency_job_id":null,"html_url":"https://github.com/luckydonald/pytgbot","commit_stats":{"total_commits":696,"total_committers":6,"mean_commits":116.0,"dds":0.4252873563218391,"last_synced_commit":"2f84b11253873f7af1bc7539eb7d93197d51c90c"},"previous_names":[],"tags_count":84,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckydonald%2Fpytgbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckydonald%2Fpytgbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckydonald%2Fpytgbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckydonald%2Fpytgbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luckydonald","download_url":"https://codeload.github.com/luckydonald/pytgbot/tar.gz/refs/heads/release","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230345782,"owners_count":18211997,"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":["bot","pytgbot","python","python-3","python3","python34","python35","python36","pythonic","telegram","telegram-bot-api"],"created_at":"2024-08-04T09:01:39.731Z","updated_at":"2025-10-08T18:13:22.142Z","avatar_url":"https://github.com/luckydonald.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# pytgbot - Telegram Bot API [`5`.`7`](https://core.telegram.org/bots/api)\n### Version [5.7 (stable)](https://github.com/luckydonald/pytgbot/blob/master/CHANGELOG.md#changelog) [![Join pytgbot group on telegram](https://img.shields.io/badge/Telegram%20Group-Join-blue.svg)](https://telegram.me/pytg_group)\n###### Python module to access the telegram bot api.\n\nNative python package with a pure Python interface for the [Telegram Bot API](https://core.telegram.org/bots).\n\u003e The code is generated directly from the API documentation, meaning up-to-date code is a matter of minutes.\n\n# Recent changes\n - Updated with official API changes\n\n [Older changes...](CHANGELOG.md)\n\n# Are you using pytgbot?\n\nIf you're using this library to build your Telegram Bots, We'd love to know and share the bot with the world.\nTell us about it - **[here](https://github.com/luckydonald/pytgbot/wiki/Who's-using-pytgbot%3F)**\n\nCheck out the [Who's using pytgbot](https://github.com/luckydonald/pytgbot/wiki/Who's-using-pytgbot%3F) wiki page to know more about what people have been building with this library.\n\n# Installation\n### Releases\nReleased versions can be found at several locations:\n- The [python package index](https://pypi.org/project/pytgbot/#history) (`pip install`),\n- on GitHub in the [release section](https://github.com/luckydonald/pytgbot/releases)\n- and in the git files as regular tags.\n\n#### Latest Stable\nThe [latest version](#releases) seems to be version `4.9.1`. For other releases you must adapt the examples below.\n\n##### Python package index (recommended)\n```sh\npip install pytgbot==4.9.1\n```\n\n##### Manually\n```sh\ngit clone -b v4.9.1 https://github.com/luckydonald/pytgbot.git\ncd pytgbot\npython setup.py install\n```\n\n#### Bleeding edge\nTo get the most current code manually\n```\ngit clone https://github.com/luckydonald/pytgbot.git\ncd pytgbot\npython setup.py install\n```\n\n# Updating\n\n#### Latest Stable\nThe [latest version](#releases) seems to be version `4.9.1`. For other releases you must adapt the examples below.\n\n##### Python package index (recommended)\n```sh\npip install -U pytgbot==4.9.1\n```\n\n##### Manually\n```sh\ncd pytgbot\ngit fetch\ngit checkout v4.9.1\npython setup.py install\n```\n\n#### Bleeding edge\nTo get the most current code manually\n```\ncd pytgbot\ngit fetch\ngit checkout master\ngit pull\npython setup.py install\n```\n\n\n# Usage\n\n```python\nfrom pytgbot import Bot\n\nAPI_KEY='123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11'  # change this to the token you get from @BotFather\nCHAT='@username'  # can be a @username or a id, change this to your own @username or id for example.\n\nbot = Bot(API_KEY)\n\n# sending messages:\nbot.send_message(CHAT, \"Example Text!\")\n\n# getting events:\nfor x in bot.get_updates():\n\tprint(x)\n\n```\n\nAll the functions can be found in the `Bot` class in the [pytgbot/bot.py](https://github.com/luckydonald/pytgbot/blob/master/pytgbot/bot.py) file.\nThey are pythonic in small letters with underscores instead of camel case, for example [getUpdates](https://core.telegram.org/bots/api#getupdates) is `bot.get_updates()`.\n## Documentation\nYou can always inspect the documentation inside the code.\nYou can also use the python `help()` command in the interactive interpreter:\n```py\n\u003e\u003e\u003e from pytgbot import Bot\n\u003e\u003e\u003e help(Bot)\n\u003e\u003e\u003e # or\n\u003e\u003e\u003e help(Bot.get_updates)\n```\n\n## Custom servers\nIf you want to use a custom Telegram API server, e.g. https://telegram.rest/ it is as simple as setting `base_url` and `download_url` when creating the bot:\n```py\nbot = Bot(API_KEY, base_url=\"https://telegram.rest/bot{api_key}/{command}\", download_url=\"https://telegram.rest/file/bot{api_key}/{file}\")\n```\n\n## Examples\nHave a look into the [examples](https://github.com/luckydonald/pytgbot/tree/master/examples) folder.\n\n# In case of errors\nFirst you should set logging to level `DEBUG` to see what's going on.\n```py\n# add this to the first lines in your file\nimport logging\nlogging.basicConfig(level=logging.DEBUG)\n```\n\nIf you are about to open a new issue, search the existing ones (open and closed) first.\nSometimes they are already reported or even solved.\n\n# Note for maintainers of this package:\nBest way to apply changes is to create a patch from the commit containing the new generated files `output`.\n\n```\ngit apply --verbose --reject --no-index -C1 --whitespace=fix --ignore-space-change --ignore-whitespace --directory pytgbot/ NAME.patch\nfind ./pytgbot/ -type f -name '*.rej' | xargs --replace={}  --max-args=1   echo \"{} {}\"\nfind ./pytgbot/ -type f -name '*.rej' |  xargs  --replace={}  --max-args=1  bash -c 'file=\"{}\";file=\"${file%.*}\"; echo wiggle --replace ${file} {};'\nwiggle --replace pytgbot\n```\nYou may need to install wiggle: `brew install wiggle`\n_See also https://stackoverflow.com/questions/4770177/git-patch-does-not-apply_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckydonald%2Fpytgbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluckydonald%2Fpytgbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckydonald%2Fpytgbot/lists"}