https://github.com/InsanusMokrassar/ktgbotapi
Type-safe library for work with Telegram Bot API
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (5.4%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Type-safe library for work with Telegram Bot API
Basic Info
- Host: GitHub
- Owner: InsanusMokrassar
- License: apache-2.0
- Language: Kotlin
- Default Branch: master
- Homepage: https://docs.inmo.dev/tgbotapi/index.html
- Size: 199 MB
Statistics
- Stars: 409
- Watchers: 3
- Forks: 33
- Open Issues: 17
- Releases: 204
Topics
Metadata Files
README.md
TelegramBotAPI

| Docs |
|
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| Useful repos |
|
| Misc |
|
| Platforms |
|
| Experimental Platforms |
|
Hello! This is a set of libraries for working with Telegram Bot API.
Examples
There are several things you need to do to launch examples below:
- Add
mavenCentral()to your project repositories - Add dependency
implementation "dev.inmo:tgbotapi:$tgbotapi_version"- Replace
tgbotapi_versionwith exact version (see last one in the table above) or put variable with this name in project - Alternative variant for maven here
- Replace
More including instructions available here. Other configuration examples:
Most common example
```kotlin suspend fun main() { val bot = telegramBot(TOKEN)
bot.buildBehaviourWithLongPolling { println(getMe())
onCommand("start") {
reply(it, "Hi:)")
}
}.join() } ```
In this example you will see information about this bot at the moment of starting and answer with Hi:) every time it
gets message /start
Handling only last messages
```kotlin suspend fun main() { val bot = telegramBot(TOKEN)
val flowsUpdatesFilter = FlowsUpdatesFilter() bot.buildBehaviour(flowUpdatesFilter = flowsUpdatesFilter) { println(getMe())
onCommand("start") {
reply(it, "Hi:)")
}
retrieveAccumulatedUpdates(this).join()
} } ```
The main difference with the previous example is that bot will get only last updates (accumulated before bot launch and maybe some updates it got after launch)
Build a little bit more complex behaviour
```kotlin suspend fun main() { val bot = telegramBot(TOKEN)
bot.buildBehaviourWithLongPolling { println(getMe())
val nameReplyMarkup = ReplyKeyboardMarkup(
matrix {
row {
+SimpleKeyboardButton("nope")
}
}
)
onCommand("start") {
val photo = waitPhoto(
SendTextMessage(it.chat.id, "Send me your photo please")
).first()
val name = waitText(
SendTextMessage(
it.chat.id,
"Send me your name or choose \"nope\"",
replyMarkup = nameReplyMarkup
)
).first().text.takeIf { it != "nope" }
sendPhoto(
it.chat,
photo.mediaCollection,
entities = buildEntities {
if (name != null) regular(name) // may be collapsed up to name ?.let(::regular)
}
)
}
}.join() } ```
More examples
You may find examples in this project. Besides, you are always welcome in our docs and chat.
Bot API Server Notice
Under the hood, default bots realizations will try to use links (PathedFile#filePath) as files each time you are trying to download file from telegram in any way - via saving to file, use stream or download as byte array. To let bot correctly download files from bot api server, you must:
- Run bot api server locally
to proxy requests for files to the server where bot api server has been hosted
- In case of local bot api server (shared one host machine) you must ensure that access to bot api server has been
granted for your bot. For example, aiogram/telegram-bot-api image
use
101UID/GID in linux for user and group as owners. So, your bot must run under user included in101group (likesystemd-journal) or be101UID user (likesystemd-resolve)
- In case of local bot api server (shared one host machine) you must ensure that access to bot api server has been
granted for your bot. For example, aiogram/telegram-bot-api image
use
- OR Use some reverse proxy (like nginx). It will allow you to broadcast your bots files without linux rights problems
- Set TelegramAPIUrlsKeeper#fileLinkUrlMapper to map urls to let bot execute requests to your nginx proxy
Owner
- Login: InsanusMokrassar
- Kind: user
- Website: https://insanusmokrassar.github.io/
- Repositories: 43
- Profile: https://github.com/InsanusMokrassar
Kotlin Developer
GitHub Events
Total
- Create event: 91
- Issues event: 15
- Release event: 24
- Watch event: 43
- Delete event: 47
- Issue comment event: 27
- Push event: 312
- Pull request review event: 17
- Pull request review comment event: 24
- Pull request event: 155
- Fork event: 6
Last Year
- Create event: 91
- Issues event: 15
- Release event: 24
- Watch event: 43
- Delete event: 47
- Issue comment event: 27
- Push event: 312
- Pull request review event: 17
- Pull request review comment event: 24
- Pull request event: 155
- Fork event: 6
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| InsanusMokrassar | o****5@g****m | 2,756 |
| bpavuk | b****y@g****m | 29 |
| madhead | s****u@g****m | 11 |
| renovate[bot] | 2****] | 9 |
| vasya | t****a@l****u | 9 |
| d1snin | me@d****v | 8 |
| Gabryel Monteiro | g****m@g****m | 5 |
| Kirill Romanov | d****1@g****m | 5 |
| McModder | me@m****w | 4 |
| Renovate Bot | b****t@r****m | 4 |
| slesh | s****3@g****m | 4 |
| Alex | x****a@r****u | 2 |
| SuLG-k | n****v@g****m | 2 |
| Alex | b****k@e****g | 1 |
| Mefilt | m****t@g****m | 1 |
| Michael Rittmeister | dr@s****i | 1 |
| Pavel Klimatov | m****z@y****u | 1 |
| Sergey Tolmachev | t****u@g****m | 1 |
| lbia | l****o@o****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 23
- Total pull requests: 372
- Average time to close issues: 6 months
- Average time to close pull requests: 19 days
- Total issue authors: 11
- Total pull request authors: 12
- Average comments per issue: 1.04
- Average comments per pull request: 0.09
- Merged pull requests: 139
- Bot issues: 2
- Bot pull requests: 207
Past Year
- Issues: 8
- Pull requests: 172
- Average time to close issues: 3 days
- Average time to close pull requests: 12 days
- Issue authors: 6
- Pull request authors: 7
- Average comments per issue: 1.13
- Average comments per pull request: 0.13
- Merged pull requests: 62
- Bot issues: 0
- Bot pull requests: 95
Top Authors
Issue Authors
- InsanusMokrassar (9)
- bpavuk (3)
- BlackBaroness (2)
- renovate[bot] (2)
- ath31st (1)
- Slenkis (1)
- centralhardware (1)
- Towich (1)
- sjmf (1)
- youchenga (1)
- Nik-mmzd (1)
Pull Request Authors
- renovate[bot] (207)
- InsanusMokrassar (132)
- bpavuk (15)
- centralhardware (3)
- d1snin (2)
- DRSchlaubi (2)
- byteduck-exploit (2)
- Nik-mmzd (2)
- SuLG-ik (2)
- mefilt (2)
- BlackBaroness (2)
- klimatov (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
- Total downloads: unknown
-
Total dependent packages: 0
(may contain duplicates) -
Total dependent repositories: 0
(may contain duplicates) - Total versions: 226
proxy.golang.org: github.com/insanusmokrassar/ktgbotapi
- Documentation: https://pkg.go.dev/github.com/insanusmokrassar/ktgbotapi#section-documentation
- License: apache-2.0
-
Latest release: v28.0.1+incompatible
published 6 months ago
Rankings
proxy.golang.org: github.com/InsanusMokrassar/ktgbotapi
- Documentation: https://pkg.go.dev/github.com/InsanusMokrassar/ktgbotapi#section-documentation
- License: apache-2.0
-
Latest release: v28.0.1+incompatible
published 6 months ago
Rankings
Dependencies
- actions/first-interaction v1 composite
- actions/checkout v2 composite
- actions/setup-java v1 composite
- peaceiris/actions-gh-pages v3 composite
- actions/labeler v2 composite
- actions/checkout v2 composite
- actions/setup-java v1 composite