tg-d 0.0.2

Telegram Bot API client library for the D programming language


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

tg.d Repository pipeline status coverage report MIT Licence Package version

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:

namedescription
action.dShows all kinds of actions that bot can broadcast to users (for example: ... typing, ... sending photo)
buttons.dSends messages with attached inline keyboard
echo.dSends user's messages back
edit.dEdits own messages
livelocation.dSends location and updates it
reply.dReplies to user's messages
sendthings.dSends photos, videos, audio files, locations, venues and other kinds of data
Authors:
  • Pavel Chebotarev
  • Anton Fediushin
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 2018-Sep-06
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 25 downloads total

Score:
0.4
Short URL:
tg-d.dub.pm