tg-d ~16-add-more-contracts-to-prevent-errors
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
tg.d
tg.d is a Telegram Bot API client implementation built to make fast and safe bots with the help of the D programming language.
Documentation
API reference is available here.
Getting updates
Currently, only long polling is supported. Use TelegramBot.pollUpdates
which provides high-level abstraction over TelegramBot.getUpdates
.
import tg.d;
void main() {
while(true) {
foreach(update; TelegramBot("token").pollUpdates) {
// Do something with `update`
}
}
}
Notice that everything is done in while(true)
loop. It's possible because TelegramBot.pollUpdates
defines timeout of 3 seconds by default which means that it'll block the running thread for 3-ish seconds.
- Registered by Anton Fediushin
- ~16-add-more-contracts-to-prevent-errors released 6 years ago
- AntonMeep/tg.d
- MIT
- Copyright for portions of project tg.d are held by Pavel Chebotarev, 2018 as part of project telega (https://github.com/nexor/telega). All other copyright for project tg.d are held by Anton Fediushin, 2018.
- Authors:
- Dependencies:
- vibe-d:data, vibe-d:tls, vibe-core, vibe-d:http
- Versions:
-
0.0.2 2018-Sep-06 0.0.1 2018-Aug-17 ~master 2020-Mar-21 ~16-add-more-contracts-to-prevent-errors 2018-Aug-16 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
76 downloads total
-
- Score:
- 2.1
- Short URL:
- tg-d.dub.pm