TelegramBot

Main structure representing one bot

Every method has an overload which takes <MethodName>Method structure which can be used to pass arguments that were recently added or that are rarely used and thus doesn't have an appropriate overload.

struct TelegramBot {
Json delegate(string, Json) @safe m_fakecall;
SendMediaGroupMethod m;
SetChatTitleMethod m;
SetChatDescriptionMethod m;
AnswerInlineQueryMethod m;
}

Constructors

this
this(string token)

Create a new bot using token

Members

Functions

addStickerToSet
bool addStickerToSet(int user_id, string name, string png_sticker, string emojis)
bool addStickerToSet(AddStickerToSetMethod m)

Add a new sticker to a set

answerCallbackQuery
bool answerCallbackQuery(string callback_query_id)
bool answerCallbackQuery(AnswerCallbackQueryMethod m)

Answer to a callback query sent from inline keyboard

answerInlineQuery
bool answerInlineQuery(AnswerInlineQueryMethod m)

Delete a sticker from a set

createNewStickerSet
bool createNewStickerSet(int user_id, string name, string title, string png_sticker, string emojis)
bool createNewStickerSet(CreateNewStickerSetMethod m)

Create new sticker set owned by a user

deleteChatPhoto
bool deleteChatPhoto(T chat_id)
bool deleteChatPhoto(DeleteChatPhotoMethod m)

Delete a chat photo

deleteChatStickerSet
bool deleteChatStickerSet(T chat_id)
bool deleteChatStickerSet(DeleteChatStickerSetMethod m)

Delete a group sticker set from a supergroup

deleteMessage
bool deleteMessage(T chat_id, int message_id)
bool deleteMessage(DeleteMessageMethod m)

Delete a message

deleteStickerFromSet
bool deleteStickerFromSet(string sticker)
bool deleteStickerFromSet(DeleteStickerFromSetMethod m)

Delete a sticker from a set

deleteWebhook
bool deleteWebhook()

Delete webhook integration

editMessageCaption
Message editMessageCaption(T chat_id, int message_id, string caption)
Message editMessageCaption(string inline_message_id, string caption)
Message editMessageCaption(EditMessageCaptionMethod m)

Edit caption of a message

editMessageLiveLocation
Message editMessageLiveLocation(T chat_id, int message_id, float latitude, float longitude)
Message editMessageLiveLocation(string inline_message_id, float latitude, float longitude)
Message editMessageLiveLocation(EditMessageLiveLocationMethod m)

Edit live location message

editMessageMedia
Message editMessageMedia(T chat_id, int message_id, InputMedia media)
Message editMessageMedia(string inline_message_id, InputMedia media)
Message editMessageMedia(EditMessageMediaMethod m)

Edit audio, document, photo or video message

editMessageReplyMarkup
Message editMessageReplyMarkup(T chat_id, int message_id, InlineKeyboardMarkup reply_markup)
Message editMessageReplyMarkup(string inline_message_id, InlineKeyboardMarkup reply_markup)
Message editMessageReplyMarkup(EditMessageReplyMarkupMethod m)

Edit reply markup of a message

editMessageText
Message editMessageText(T chat_id, int message_id, string text)
Message editMessageText(string inline_message_id, string text)
Message editMessageText(EditMessageTextMethod m)

Edit text of a message

exportChatInviteLink
string exportChatInviteLink(T chat_id)
string exportChatInviteLink(ExportChatInviteLinkMethod m)

Generate a new invite link for a chat

forwardMessage
Message forwardMessage(T1 chat_id, T2 from_chat_id, int message_id)
Message forwardMessage(ForwardMessageMethod m)

Forward message from from_chat_id to chat_id

getChat
Chat getChat(T chat_id)
Chat getChat(GetChatMethod m)

Get up-to-date information about the chat

getChatAdministrators
ChatMember[] getChatAdministrators(T chat_id)
ChatMember[] getChatAdministrators(GetChatAdministratorsMethod m)

Get a list of administrators in a chat

getChatMember
ChatMember getChatMember(T chat_id, int user_id)
ChatMember getChatMember(GetChatMemberMethod m)

Get information about a member of a chat

getChatMembersCount
int getChatMembersCount(T chat_id)
int getChatMembersCount(GetChatMembersCountMethod m)

Get the number of members in a chat

getFile
File getFile(string file_id)
File getFile(GetFileMethod m)

Get info about a file and prepare it for downloading

getMe
User getMe()

Get current bot info

getStickerSet
StickerSet getStickerSet(string name)
StickerSet getStickerSet(GetStickerSetMethod m)

Get a sticker set

getUpdates
Update[] getUpdates(int offset = 0, int limit = 100, Duration timeout = 3.seconds, string[] allowed_updates = [])
Update[] getUpdates(GetUpdatesMethod m)

Receive incoming updates using long polling

getUserProfilePhotos
UserProfilePhotos getUserProfilePhotos(int user_id)
UserProfilePhotos getUserProfilePhotos(GetUserProfilePhotosMethod m)

Get a list of profile pictures for specified user

getWebhookInfo
WebhookInfo getWebhookInfo()

Get current webhook status

kickChatMember
bool kickChatMember(T chat_id, int user_id)
bool kickChatMember(KickChatMemberMethod m)

Kick a user from a group, a supergroup or a channel

leaveChat
bool leaveChat(T chat_id)
bool leaveChat(LeaveChatMethod m)

Leave a group, supergroup or channel

pinChatMessage
bool pinChatMessage(T chat_id, int message_id)
bool pinChatMessage(PinChatMessageMethod m)

Pin a message in a supergroup or a channel

pollUpdates
auto pollUpdates(Duration timeout = 3.seconds, string[] allowed_updates = [])

Range-based interface for getUpdates

promoteChatMember
bool promoteChatMember(T chat_id, int user_id)
bool promoteChatMember(PromoteChatMemberMethod m)

Promote or demote a user in a supergroup or a channel

restrictChatMember
bool restrictChatMember(T chat_id, int user_id)
bool restrictChatMember(RestrictChatMemberMethod m)

Restrict a user in a supergroup

sendAnimation
Message sendAnimation(T chat_id, string animation)
Message sendAnimation(SendAnimationMethod m)

Send animation

sendAudio
Message sendAudio(T chat_id, string audio)
Message sendAudio(SendAudioMethod m)

Send audio

sendChatAction
bool sendChatAction(T chat_id, ChatAction action)
bool sendChatAction(SendChatActionMethod m)

Send chat action

sendContact
Message sendContact(T chat_id, string phone_number, string first_name, string last_name = "")
Message sendContact(SendContactMethod m)

Send phone contact

sendDocument
Message sendDocument(T chat_id, string document)
Message sendDocument(SendDocumentMethod m)

Send file

sendLocation
Message sendLocation(T chat_id, float latitude, float longitude)
Message sendLocation(SendLocationMethod m)

Send point on the map

sendMediaGroup
Message sendMediaGroup(SendMediaGroupMethod m)

Send video message

sendMessage
Message sendMessage(T chat_id, string text)
Message sendMessage(T chat_id, int reply_to, string text)
Message sendMessage(SendMessageMethod m)

Send text message

sendPhoto
Message sendPhoto(T chat_id, string photo)
Message sendPhoto(SendPhotoMethod m)

Send photo

sendSticker
Message sendSticker(T chat_id, string sticker)
Message sendSticker(SendStickerMethod m)

Send webp sticker

sendVenue
Message sendVenue(T chat_id, float latitude, float longitude, string title, string address)
Message sendVenue(SendVenueMethod m)

Send information about a venue

sendVideo
Message sendVideo(T chat_id, string video)
Message sendVideo(SendVideoMethod m)

Send video

sendVideoNote
Message sendVideoNote(T chat_id, string video_note)
Message sendVideoNote(SendVideoNoteMethod m)

Send video message

sendVoice
Message sendVoice(T chat_id, string voice)
Message sendVoice(SendVoiceMethod m)

Send voice message

setChatDescription
bool setChatDescription(SetChatDescriptionMethod m)

Delete a chat photo

setChatPhoto
bool setChatPhoto(T chat_id, InputFile photo)
bool setChatPhoto(SetChatPhotoMethod m)

Set a new profile photo for the chat

setChatStickerSet
bool setChatStickerSet(T chat_id, string sticker_set_name)
bool setChatStickerSet(SetChatStickerSetMethod m)

Set a new group sticker set for a supergroup

setChatTitle
bool setChatTitle(SetChatTitleMethod m)

Delete a chat photo

setStickerPositionInSet
bool setStickerPositionInSet(string sticker, int position)
bool setStickerPositionInSet(SetStickerPositionInSetMethod m)

Move a sticker in a set to a specific position

setWebhook
bool setWebhook(string url, string[] allowed_updates = [], int max_connections = 40)

Set webhook to be used to receive incoming updates

stopMessageLiveLocation
Message stopMessageLiveLocation(T chat_id, int message_id)
Message stopMessageLiveLocation(string inline_message_id)
Message stopMessageLiveLocation(StopMessageLiveLocationMethod m)

Stop updating a live location message

unbanChatMember
bool unbanChatMember(T chat_id, int user_id)
bool unbanChatMember(UnbanChatMemberMethod m)

Unban a previously kicked user in a group, a supergroup or a channel

unpinChatMessage
bool unpinChatMessage(T chat_id)
bool unpinChatMessage(UnpinChatMessageMethod m)

Unpin a message in a supergroup or a channel

uploadStickerFile
File uploadStickerFile(int user_id, InputFile png_sticker)
File uploadStickerFile(UploadStickerFileMethod m)

Upload a .png file to create a new sticker set or add to an existing one

Meta