tg-d 0.0.2
Telegram Bot API client library for the D programming language
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.
Note that project's development happens on the GitLab. GitHub repository is a mirror, it might not always be up-to-date.
Documentation
API reference is available here. Telegram Bot API documentation 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`
}
}
}
Data structures such as Update
, Message
and others have isNull
property which can be used to check if field has a value:
if(!update.message.isNull) {
// Update is a message
} else if(!update.edited_message.isNull) {
// Update is a edited message
} else ...
Examples
Are in the examples
directory:
name | description |
---|---|
action.d | Shows all kinds of actions that bot can broadcast to users (for example: ... typing , ... sending photo ) |
buttons.d | Sends messages with attached inline keyboard |
echo.d | Sends user's messages back |
edit.d | Edits own messages |
livelocation.d | Sends location and updates it |
reply.d | Replies to user's messages |
sendthings.d | Sends photos, videos, audio files, locations, venues and other kinds of data |
- Registered by Anton Fediushin
- 0.0.2 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
-
1 downloads this month
-
77 downloads total
-
- Score:
- 2.1
- Short URL:
- tg-d.dub.pm