Skip to content
Telegram Bot API client library for the D programming language
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

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.


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 ...


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
You can’t perform that action at this time.