{"id":13764853,"url":"https://github.com/reo7sp/tgbot-cpp","last_synced_at":"2025-08-11T21:49:27.405Z","repository":{"id":34382468,"uuid":"38309014","full_name":"reo7sp/tgbot-cpp","owner":"reo7sp","description":"C++ library for Telegram bot API","archived":false,"fork":false,"pushed_at":"2025-07-01T08:49:02.000Z","size":12974,"stargazers_count":1094,"open_issues_count":71,"forks_count":258,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-07-01T09:41:49.011Z","etag":null,"topics":["bot","cpp","telegram","telegram-api","telegram-bot"],"latest_commit_sha":null,"homepage":"http://reo7sp.github.io/tgbot-cpp","language":"C++","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/reo7sp.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":"2015-06-30T12:53:27.000Z","updated_at":"2025-07-01T08:49:06.000Z","dependencies_parsed_at":"2025-01-18T15:07:02.745Z","dependency_job_id":"b8bf55a2-719c-4404-85b9-184eb2064dc7","html_url":"https://github.com/reo7sp/tgbot-cpp","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/reo7sp/tgbot-cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reo7sp%2Ftgbot-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reo7sp%2Ftgbot-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reo7sp%2Ftgbot-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reo7sp%2Ftgbot-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reo7sp","download_url":"https://codeload.github.com/reo7sp/tgbot-cpp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reo7sp%2Ftgbot-cpp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269963275,"owners_count":24504301,"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-08-11T02:00:10.019Z","response_time":75,"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":["bot","cpp","telegram","telegram-api","telegram-bot"],"created_at":"2024-08-03T16:00:30.459Z","updated_at":"2025-08-11T21:49:27.361Z","avatar_url":"https://github.com/reo7sp.png","language":"C++","readme":"# tgbot-cpp\n\n[![GitHub contributors](https://img.shields.io/github/contributors/reo7sp/tgbot-cpp.svg)](https://github.com/reo7sp/tgbot-cpp/graphs/contributors)\n\nC++ library for Telegram bot API.\n\nDocumentation is located [here](http://reo7sp.github.io/tgbot-cpp).\n\n\n## State\n\n- [x] Telegram Bot API 7.2\n- [ ] [MaybeInaccessibleMessage](https://core.telegram.org/bots/api#maybeinaccessiblemessage)\n- [ ] [Message-\u003epinnedMessage](https://core.telegram.org/bots/api#message)\n- [ ] [CallbackQuery-\u003emessage](https://core.telegram.org/bots/api#callbackquery)\n- [ ] [Deep Linking](https://core.telegram.org/bots/features#deep-linking)\n\n\n## Sample\n\nSimple echo bot which sends everything it receives:\n\n```cpp\n#include \u003cstdio.h\u003e\n#include \u003ctgbot/tgbot.h\u003e\n\nint main() {\n    TgBot::Bot bot(\"PLACE YOUR TOKEN HERE\");\n    bot.getEvents().onCommand(\"start\", [\u0026bot](TgBot::Message::Ptr message) {\n        bot.getApi().sendMessage(message-\u003echat-\u003eid, \"Hi!\");\n    });\n    bot.getEvents().onAnyMessage([\u0026bot](TgBot::Message::Ptr message) {\n        printf(\"User wrote %s\\n\", message-\u003etext.c_str());\n        if (StringTools::startsWith(message-\u003etext, \"/start\")) {\n            return;\n        }\n        bot.getApi().sendMessage(message-\u003echat-\u003eid, \"Your message is: \" + message-\u003etext);\n    });\n    try {\n        printf(\"Bot username: %s\\n\", bot.getApi().getMe()-\u003eusername.c_str());\n        TgBot::TgLongPoll longPoll(bot);\n        while (true) {\n            printf(\"Long poll started\\n\");\n            longPoll.start();\n        }\n    } catch (TgBot::TgException\u0026 e) {\n        printf(\"error: %s\\n\", e.what());\n    }\n    return 0;\n}\n```\n\nAll other samples are located [here](samples).\n\n\n## Dependencies\n\nDependencies:\n- CMake\n- Boost\n- OpenSSL\n- ZLib\n- Libcurl (optional unless you want to use curl-based http client `CurlHttpClient`).\n\n\n## Library installation on Linux\n\nYou can install dependencies on Debian-based distibutives with these commands:\n\n```sh\nsudo apt install g++ make binutils cmake libboost-system-dev libssl-dev zlib1g-dev libcurl4-openssl-dev\n```\n\nOptionally, install the dependencies for testing and documenting\n```sh\nsudo apt install libboost-test-dev doxygen\n```\n\nYou can compile and install the library with these commands:\n\n```sh\ngit clone https://github.com/reo7sp/tgbot-cpp\ncd tgbot-cpp\ncmake .\nmake -j4\nsudo make install\n```\n\nAlternatively, you can use Docker to build and run your bot. Set the base image of your's Dockerfile to [reo7sp/tgbot-cpp](https://hub.docker.com/r/reo7sp/tgbot-cpp/).\n\n\n## Library installation on MacOS\n\nYou can install dependencies with these commands:\n\n```sh\nbrew install gcc cmake boost openssl zlib curl\n```\n\nYou can compile and install the library like Linux instructions.\n\n\n## Library installation on Windows\n\n### Download vcpkg and tgbot-cpp\n\nTaken from [Vcpkg - Quick Start: Windows](https://github.com/Microsoft/vcpkg/#quick-start-windows).\n\nPrerequisites:\n- Windows 7 or newer\n- [Git][https://git-scm.com/downloads]\n- [Visual Studio][https://visualstudio.microsoft.com] 2015 Update 3 or greater with the English language pack\n\nFirst, download and bootstrap vcpkg itself; it can be installed anywhere, but generally we recommend using vcpkg as a submodule for CMake projects, and installing it globally for Visual Studio projects. We recommend somewhere like `C:\\src\\vcpkg` or `C:\\dev\\vcpkg`, since otherwise you may run into path issues for some port build systems.\n\n```cmd\n\u003e git clone https://github.com/microsoft/vcpkg\n\u003e .\\vcpkg\\bootstrap-vcpkg.bat\n```\n\nIn order to use vcpkg with Visual Studio, run the following command (may require administrator elevation):\n\n```cmd\n\u003e .\\vcpkg\\vcpkg integrate install\n```\n\nTo install the libraries for Windows x64, run:\n\n```cmd\n\u003e .\\vcpkg\\vcpkg install tgbot-cpp:x64-windows\n```\n\nTo install for Windows x86, run:\n\n```cmd\n\u003e .\\vcpkg\\vcpkg install tgbot-cpp\n```\n\nThe library will now be installed and Visual Studio should be able to find the vcpkg installation.\n\n### Setup project with CMakeLists\n\nUse the [example CMakeLists.txt](samples/echobot/CMakeLists.txt) with changes:\n\n1. Remove `/usr/local/include`\n2. Change `/usr/local/lib/libTgBot.a` to `C:/src/vcpkg/installed/x64-windows/lib/TgBot.lib` or something simmilar according to your own installation path.\n\n\n## Bot compilation\n\n### With CMake\n\n[Example CMakeLists.txt](samples/echobot/CMakeLists.txt)\n\nAlso, you can treat this repository as a submodule of your project, for example, see [echobot-submodule](samples/echobot-submodule/CMakeLists.txt).\n\n### Without CMake\n\n```sh\ng++ telegram_bot.cpp -o telegram_bot --std=c++14 -I/usr/local/include -lTgBot -lboost_system -lssl -lcrypto -lpthread\n```\n\n### Build options\n\n```\n-DTGBOT_DISABLE_NAGLES_ALGORITHM   # Disable 'Nagle's algorithm'\n-DTGBOT_CHANGE_SOCKET_BUFFER_SIZE  # Socket Buffer Size Expansion\n-DTGBOT_CHANGE_READ_BUFFER_SIZE    # Read Buffer Size Expansion\n```\n\n\n## Licence\n[The MIT License](https://github.com/reo7sp/tgbot-cpp/blob/master/LICENSE).\n","funding_links":[],"categories":["Telegram Libraries","一般机器人（bots）","Bots"],"sub_categories":["C Plus Plus","机器人类库","Bot Libs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freo7sp%2Ftgbot-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freo7sp%2Ftgbot-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freo7sp%2Ftgbot-cpp/lists"}