tg.d

Tg.d is a D client library for Telegram Bot API

Take a look at TelegramBot which is the main structure representing a bot.

1 import tg.d;
2 
3 int main() {
4 	auto Bot = TelegramBot("token");
5 	while(true) {
6 		foreach(update; Bot.pollUpdates) {
7 			Bot.sendMessage(update.message.chat.id, "Hello, world!");
8 		}
9 	 }
10 }

Members

Aliases

InlineQueryResult
alias InlineQueryResult = Algebraic!(InlineQueryResultArticle, InlineQueryResultPhoto, InlineQueryResultGif, InlineQueryResultMpeg4Gif, InlineQueryResultVideo, InlineQueryResultAudio, InlineQueryResultVoice, InlineQueryResultDocument, InlineQueryResultLocation, InlineQueryResultVenue, InlineQueryResultContact, InlineQueryResultGame, InlineQueryResultCachedPhoto, InlineQueryResultCachedGif, InlineQueryResultCachedMpeg4Gif, InlineQueryResultCachedSticker, InlineQueryResultCachedDocument, InlineQueryResultCachedVideo, InlineQueryResultCachedVoice, InlineQueryResultCachedAudio)

One result of an inline query

InputMedia
alias InputMedia = Algebraic!(InputMediaAnimation, InputMediaDocument, InputMediaAudio, InputMediaPhoto, InputMediaVideo)

Content of a media message to be sent

InputMessageContent
alias InputMessageContent = Algebraic!(InputTextMessageContent, InputLocationMessageContent, InputVenueMessageContent, InputContactMessageContent)

Content of a message to be sent as a result of an inline query

ReplyMarkup
alias ReplyMarkup = Algebraic!(InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply)

Inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user

TelegramID
alias TelegramID = Algebraic!(long, string)

Unique identifier for the target chat or username of the target channel

Classes

TelegramBotException
class TelegramBotException

An exception thrown by tg.d on errors

Enums

ChatAction
enum ChatAction

Chat action to be broadcast

ChatType
enum ChatType

Type of chat

EntityType
enum EntityType

Type of the MessageEntity

FacePart
enum FacePart

Represents parts of the face

ParseMode
enum ParseMode

Formatting options

UserStatus
enum UserStatus

Member's status in the chat

Structs

AddStickerToSetMethod
struct AddStickerToSetMethod

Method to add a new sticker to a set created by the bot

Animation
struct Animation

Animation file (GIF or H.264/MPEG-4 AVC video without sound)

AnswerCallbackQueryMethod
struct AnswerCallbackQueryMethod

Method to send answers to callback queries sent from inline keyboards

AnswerInlineQueryMethod
struct AnswerInlineQueryMethod

Method to send answers to an inline query

Audio
struct Audio

Audio file to be treated as music by the Telegram clients

CallbackGame
struct CallbackGame

A placeholder, currently holds no information

CallbackQuery
struct CallbackQuery

Incoming callback query

Chat
struct Chat

Chat

ChatMember
struct ChatMember

Information about one member of a chat

ChatPhoto
struct ChatPhoto

Chat photo

ChosenInlineResult
struct ChosenInlineResult

Result of an inline query that was chosen by the user and sent to their chat partner

Contact
struct Contact

Phone contact

CreateNewStickerSetMethod
struct CreateNewStickerSetMethod

Method to create new sticker set owned by a user

DeleteChatPhotoMethod
struct DeleteChatPhotoMethod

Method to delete a chat photo

DeleteChatStickerSetMethod
struct DeleteChatStickerSetMethod

Method to delete a group sticker set from a supergroup

DeleteMessageMethod
struct DeleteMessageMethod

Method to delete a message, including service messages

DeleteStickerFromSetMethod
struct DeleteStickerFromSetMethod

Method to delete a sticker from a set created by the bot

DeleteWebhookMethod
struct DeleteWebhookMethod

Method to remove webhook integration

Document
struct Document

General file (as opposed to photos, voice messages and audio files).

EditMessageCaptionMethod
struct EditMessageCaptionMethod

Method to edit captions of messages sent by the bot or via the bot

EditMessageLiveLocationMethod
struct EditMessageLiveLocationMethod

Method to edit live location messages

EditMessageMediaMethod
struct EditMessageMediaMethod

Method to edit audio, document, photo, or video messages

EditMessageReplyMarkupMethod
struct EditMessageReplyMarkupMethod

Method to edit only the reply markup of messages sent by the bot or via the bot

EditMessageTextMethod
struct EditMessageTextMethod

Method to edit text and game messages sent by the bot or via the bot

ExportChatInviteLinkMethod
struct ExportChatInviteLinkMethod

Method to generate a new invite link for a chat

File
struct File

File ready to be downloaded

ForceReply
struct ForceReply

Force user reply

ForwardMessageMethod
struct ForwardMessageMethod

Method to forward messages

Game
struct Game

Game

GameHighScore
struct GameHighScore

One row of the high scores table for a game

GetChatAdministratorsMethod
struct GetChatAdministratorsMethod

Method to get a list of administrators in a chat

GetChatMemberMethod
struct GetChatMemberMethod

Method to get information about a member of a chat

GetChatMembersCountMethod
struct GetChatMembersCountMethod

Method to get the number of members in a chat

GetChatMethod
struct GetChatMethod

Method to get up to date information about the chat

GetFileMethod
struct GetFileMethod

Method to get basic info about a file and prepare it for downloading

GetMeMethod
struct GetMeMethod

Method to get basic information about the bot

GetStickerSetMethod
struct GetStickerSetMethod

Method to get a sticker set

GetUpdatesMethod
struct GetUpdatesMethod

Method to receive incoming updates using long polling

GetUserProfilePhotosMethod
struct GetUserProfilePhotosMethod

Method to get a list of profile pictures for a user

GetWebhookInfoMethod
struct GetWebhookInfoMethod

Method to get current webhook status

InlineKeyboardButton
struct InlineKeyboardButton

One button of an inline keyboard

InlineKeyboardMarkup
struct InlineKeyboardMarkup

Inline keyboard that appears right next to the message

InlineQuery
struct InlineQuery

Incoming inline query

InlineQueryResultArticle
struct InlineQueryResultArticle

Link to an article or web page

InlineQueryResultAudio
struct InlineQueryResultAudio

Link to an mp3 audio file

InlineQueryResultCachedAudio
struct InlineQueryResultCachedAudio

Link to an mp3 audio file stored on the Telegram servers

InlineQueryResultCachedDocument
struct InlineQueryResultCachedDocument

Link to a file stored on the Telegram servers

InlineQueryResultCachedGif
struct InlineQueryResultCachedGif

Link to an animated GIF file stored on the Telegram servers

InlineQueryResultCachedMpeg4Gif
struct InlineQueryResultCachedMpeg4Gif

Link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers

InlineQueryResultCachedPhoto
struct InlineQueryResultCachedPhoto

Link to a photo stored on the Telegram servers

InlineQueryResultCachedSticker
struct InlineQueryResultCachedSticker

Link to a sticker stored on the Telegram servers

InlineQueryResultCachedVideo
struct InlineQueryResultCachedVideo

Link to a video file stored on the Telegram servers

InlineQueryResultCachedVoice
struct InlineQueryResultCachedVoice

Link to a voice message stored on the Telegram servers

InlineQueryResultContact
struct InlineQueryResultContact

Contact with a phone number

InlineQueryResultDocument
struct InlineQueryResultDocument

Link to a file

InlineQueryResultGame
struct InlineQueryResultGame

Game

InlineQueryResultGif
struct InlineQueryResultGif

Link to an animated GIF file

InlineQueryResultLocation
struct InlineQueryResultLocation

Location on a map

InlineQueryResultMpeg4Gif
struct InlineQueryResultMpeg4Gif

Link to a vide animation (H.264/MPEG-4 AVC video without sound)

InlineQueryResultPhoto
struct InlineQueryResultPhoto

Link to a photo

InlineQueryResultVenue
struct InlineQueryResultVenue

Venue

InlineQueryResultVideo
struct InlineQueryResultVideo

Link to a page containing an embedded video player or a video file

InlineQueryResultVoice
struct InlineQueryResultVoice

Link to a voice recording in an .ogg container encoded with OPUS

InputContactMessageContent
struct InputContactMessageContent

Content of a contact message to be sent as the result of an inline query

InputFile
struct InputFile

Represents the contents of a file to be uploaded

InputLocationMessageContent
struct InputLocationMessageContent

Content of a location message to be sent as the result of an inline query

InputMediaAnimation
struct InputMediaAnimation

Animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent

InputMediaAudio
struct InputMediaAudio

Audio file to be sent

InputMediaDocument
struct InputMediaDocument

General file to be sent

InputMediaPhoto
struct InputMediaPhoto

Photo to be sent

InputMediaVideo
struct InputMediaVideo

Video file to be sent

InputTextMessageContent
struct InputTextMessageContent

Content of a text message to be sent as the result of an inline query

InputVenueMessageContent
struct InputVenueMessageContent

Content of a venue message to be sent as the result of an inline query

Invoice
struct Invoice

Basic information about an invoice

KeyboardButton
struct KeyboardButton

One button of the reply keyboard

KickChatMemberMethod
struct KickChatMemberMethod

Method to kick a user from a group, a supergroup or a channel

LabeledPrice
struct LabeledPrice

Portion of the price for goods or services

LeaveChatMethod
struct LeaveChatMethod

Method for your bot to leave a group, supergroup or channel

Location
struct Location

Point on the map

MaskPosition
struct MaskPosition

Describes position on faces where a mask should be placed by default

Message
struct Message

Message

MessageEntity
struct MessageEntity

One special entity in a text message

OrderInfo
struct OrderInfo

Information about an order

PhotoSize
struct PhotoSize

One size of a photo or a file/sticker thumbnail

PinChatMessageMethod
struct PinChatMessageMethod

Method to pin a message in a supergroup or a channel

PreCheckoutQuery
struct PreCheckoutQuery

Information about an incoming pre-checkout query

PromoteChatMemberMethod
struct PromoteChatMemberMethod

Method to promote or demote a user in a supergroup or a channel

ReplyKeyboardMarkup
struct ReplyKeyboardMarkup

Custom keyboard with reply options

ReplyKeyboardRemove
struct ReplyKeyboardRemove

Remove current custom keyboard

ResponseParameters
struct ResponseParameters

Information about why a request was unsuccessful

RestrictChatMemberMethod
struct RestrictChatMemberMethod

Method to restrict a user in a supergroup

SendAnimationMethod
struct SendAnimationMethod

Method to send animation files

SendAudioMethod
struct SendAudioMethod

Method to send audio files

SendChatActionMethod
struct SendChatActionMethod

Method to send chat action

SendContactMethod
struct SendContactMethod

Method to send phone contacts

SendDocumentMethod
struct SendDocumentMethod

Method to send general files

SendLocationMethod
struct SendLocationMethod

Method to send point on the map

SendMediaGroupMethod
struct SendMediaGroupMethod

Method to send a group of photos or audios as an album

SendMessageMethod
struct SendMessageMethod

Method to send text messages

SendPhotoMethod
struct SendPhotoMethod

Method to send photos

SendStickerMethod
struct SendStickerMethod

Method to send .webp stickers

SendVenueMethod
struct SendVenueMethod

Method to send information about a venue

SendVideoMethod
struct SendVideoMethod

Method to send video files

SendVideoNoteMethod
struct SendVideoNoteMethod

Method to send video messages

SendVoiceMethod
struct SendVoiceMethod

Method to send audio files that are treated as a playable voice messages

SetChatDescriptionMethod
struct SetChatDescriptionMethod

Method to change the description of a supergroup or a channel

SetChatPhotoMethod
struct SetChatPhotoMethod

Method to set a new profile photo for the chat

SetChatStickerSetMethod
struct SetChatStickerSetMethod

Method to set a new group sticker set for a supergroup

SetChatTitleMethod
struct SetChatTitleMethod

Method to change the title of a chat

SetStickerPositionInSetMethod
struct SetStickerPositionInSetMethod

Method to move a sticker in a set created by the bot to a specific position

SetWebhookMethod
struct SetWebhookMethod

Method to specify a url and receive incoming updates via an outgoing webhook

ShippingAddress
struct ShippingAddress

Shipping address

ShippingOption
struct ShippingOption

Shipping option

ShippingQuery
struct ShippingQuery

Information about an incoming shipping query

Sticker
struct Sticker

Sticker

StickerSet
struct StickerSet

Sticker set

StopMessageLiveLocationMethod
struct StopMessageLiveLocationMethod

Method to stop updating a live location message

SuccessfulPayment
struct SuccessfulPayment

Basic information about a successful payment

TelegramBot
struct TelegramBot

Main structure representing one bot

UnbanChatMemberMethod
struct UnbanChatMemberMethod

Method to unban a previously kicked user in a supergroup or channel

UnpinChatMessageMethod
struct UnpinChatMessageMethod

Method to unpin a message in a supergroup or a channel

Update
struct Update

An incoming update

UploadStickerFileMethod
struct UploadStickerFileMethod

Method to upload a .png file with a sticker

User
struct User

Telegram user or a bot

UserProfilePhotos
struct UserProfilePhotos

User's profile pictures

Venue
struct Venue

Venue

Video
struct Video

Video file

VideoNote
struct VideoNote

Video message

Voice
struct Voice

Voice note

WebhookInfo
struct WebhookInfo

Information about the current status of a webhook

Examples

See "examples" directory

See Also

Meta

Authors

Anton Fediushin, Pavel Chebotarev Licence: MIT, see LICENCE