{"id":13537478,"url":"https://github.com/InsanusMokrassar/ktgbotapi","last_synced_at":"2025-04-02T04:30:47.893Z","repository":{"id":37450938,"uuid":"163152024","full_name":"InsanusMokrassar/ktgbotapi","owner":"InsanusMokrassar","description":"Type-safe library for work with Telegram Bot API","archived":false,"fork":false,"pushed_at":"2025-03-27T22:39:07.000Z","size":203971,"stargazers_count":378,"open_issues_count":13,"forks_count":32,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T00:28:16.870Z","etag":null,"topics":["dev-inmo-tgbotapi","hacktoberfest","kotlin","kotlin-js","kotlin-jvm","kotlin-library","kotlin-multiplatform","ktgbotapi","telegram","telegram-bot-api","telegram-bots-api","telegrambotapi","tgbotapi"],"latest_commit_sha":null,"homepage":"https://docs.inmo.dev/tgbotapi/index.html","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InsanusMokrassar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"custom":["https://www.tinkoff.ru/rm/ovsyannikov.aleksey113/ObMJ712472","https://boosty.to/insanusmokrassar"]}},"created_at":"2018-12-26T07:45:11.000Z","updated_at":"2025-03-28T10:04:32.000Z","dependencies_parsed_at":"2023-09-23T12:36:33.818Z","dependency_job_id":"e0ccf704-6d9f-4775-af88-b7fcf0aae8da","html_url":"https://github.com/InsanusMokrassar/ktgbotapi","commit_stats":{"total_commits":2774,"total_committers":19,"mean_commits":146.0,"dds":0.03460706560922855,"last_synced_commit":"191e4cff00fa5b9539e86cd29c165d1299a32f07"},"previous_names":["insanusmokrassar/telegrambotapi"],"tags_count":188,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InsanusMokrassar%2Fktgbotapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InsanusMokrassar%2Fktgbotapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InsanusMokrassar%2Fktgbotapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InsanusMokrassar%2Fktgbotapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InsanusMokrassar","download_url":"https://codeload.github.com/InsanusMokrassar/ktgbotapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246403905,"owners_count":20771527,"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":["dev-inmo-tgbotapi","hacktoberfest","kotlin","kotlin-js","kotlin-jvm","kotlin-library","kotlin-multiplatform","ktgbotapi","telegram","telegram-bot-api","telegram-bots-api","telegrambotapi","tgbotapi"],"created_at":"2024-08-01T09:00:59.467Z","updated_at":"2025-04-02T04:30:47.887Z","avatar_url":"https://github.com/InsanusMokrassar.png","language":"Kotlin","funding_links":["https://www.tinkoff.ru/rm/ovsyannikov.aleksey113/ObMJ712472","https://boosty.to/insanusmokrassar"],"categories":["Libraries"],"sub_categories":["Social"],"readme":"# TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-8.3-blue)](https://core.telegram.org/bots/api-changelog#february-12-2025)\n\n|          Docs          |                                   [![KDocs](https://img.shields.io/static/v1?label=Dokka\u0026message=KDocs\u0026color=blue\u0026logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk\u0026message=Docs\u0026color=blue\u0026logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html)                                    |\n|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|\n|      Useful repos      |                           [![Create bot](https://img.shields.io/static/v1?label=Github\u0026message=Template\u0026color=blue\u0026logo=github)](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [![Examples](https://img.shields.io/static/v1?label=Github\u0026message=Examples\u0026color=blue\u0026logo=github)](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/)                           |\n|          Misc          |                              [![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin) [![Small survey](https://img.shields.io/static/v1?label=Google\u0026message=Survey\u0026color=blue\u0026logo=google-sheets)](https://docs.google.com/forms/d/e/1FAIpQLSctdJHT_aEniyYT0-IUAEfo1hsIlezX2owlkEAYX4KPl2V2_A/viewform?usp=sf_link)                               |\n|       Platforms        |                                                                                                      ![JVM](https://img.shields.io/badge/JVM-red?style=plastic\u0026logo=openjdk\u0026logoColor=white) ![Js](https://img.shields.io/badge/JavaScript-323330?style=plastic\u0026logo=javascript\u0026logoColor=F7DF1E)                                                                                                       |\n| Experimental Platforms |                                                                                                [![Linux x64](https://img.shields.io/badge/LinuxX64-FCC624?style=plastic\u0026logo=linux\u0026logoColor=black)](https://kotlinlang.org/docs/native-target-support.html#tier-1) [![MinGW x64](https://img.shields.io/badge/MinGWX64-black?style=plastic\u0026logo=windows\u0026logoColor=green)](https://kotlinlang.org/docs/native-target-support.html#tier-1)                                                                                                 |\n\n\u003c!--- [![Telegram Channel](./resources/tg_channel_qr.jpg)](https://t.me/ktgbotapi) ---\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://t.me/ktgbotapi\"\u003e\n    \u003cimg src=\"./resources/tg_channel_qr.jpg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nHello! This is a set of libraries for working with Telegram Bot API.\n\n## Examples\n\nThere are several things you need to do to launch examples below:\n\n* Add `mavenCentral()` to your project repositories\n    * [Maven variant](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/Including-in-your-project#pomxml)\n* Add dependency `implementation \"dev.inmo:tgbotapi:$tgbotapi_version\"` \n    * Replace `tgbotapi_version` with exact version (see last one in the table above) or put variable with this name in project\n    * Alternative variant for maven [here](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/Including-in-your-project#telegrambotapi)\n\nMore including instructions [available here](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/Including-in-your-project).\nOther configuration examples:\n\n* [For multiplatform](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/tree/master/ResenderBot)\n* [For JVM](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/blob/master/GetMeBot/build.gradle)\n\n### Most common example\n\n```kotlin\nsuspend fun main() {\n  val bot = telegramBot(TOKEN)\n\n  bot.buildBehaviourWithLongPolling {\n    println(getMe())\n  \n    onCommand(\"start\") {\n      reply(it, \"Hi:)\")\n    }\n  }.join()\n}\n```\n\nIn this example you will see information about this bot at the moment of starting and answer with `Hi:)` every time it\ngets message `/start`\n\n### Handling only last messages\n\n```kotlin\nsuspend fun main() {\n  val bot = telegramBot(TOKEN)\n\n  val flowsUpdatesFilter = FlowsUpdatesFilter()\n  bot.buildBehaviour(flowUpdatesFilter = flowsUpdatesFilter) {\n    println(getMe())\n  \n    onCommand(\"start\") {\n      reply(it, \"Hi:)\")\n    }\n\n    retrieveAccumulatedUpdates(this).join()\n  }\n}\n```\n\nThe main difference with the previous example is that bot will get only last updates (accumulated before bot launch\nand maybe some updates it got after launch)\n\n### Build a little bit more complex behaviour\n\n```kotlin\nsuspend fun main() {\n  val bot = telegramBot(TOKEN)\n\n  bot.buildBehaviourWithLongPolling {\n    println(getMe())\n\n    val nameReplyMarkup = ReplyKeyboardMarkup(\n      matrix {\n        row {\n          +SimpleKeyboardButton(\"nope\")\n        }\n      }\n    )\n    onCommand(\"start\") {\n      val photo = waitPhoto(\n        SendTextMessage(it.chat.id, \"Send me your photo please\")\n      ).first()\n\n      val name = waitText(\n        SendTextMessage(\n          it.chat.id,\n          \"Send me your name or choose \\\"nope\\\"\",\n          replyMarkup = nameReplyMarkup\n        )\n      ).first().text.takeIf { it != \"nope\" }\n\n      sendPhoto(\n        it.chat,\n        photo.mediaCollection,\n        entities = buildEntities {\n          if (name != null) regular(name) // may be collapsed up to name ?.let(::regular)\n        }\n      )\n    }\n  }.join()\n}\n```\n\n### More examples\n\nYou may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are\nalways welcome in our [docs](https://docs.inmo.dev/tgbotapi/index.html) and\n[chat](https://t.me/InMoTelegramBotAPIChat).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FInsanusMokrassar%2Fktgbotapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FInsanusMokrassar%2Fktgbotapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FInsanusMokrassar%2Fktgbotapi/lists"}