tgbot-cpp
Api.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Oleg Morozenkov
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in all
12  * copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20  * SOFTWARE.
21  */
22 
23 #ifndef TGBOT_CPP_API_H
24 #define TGBOT_CPP_API_H
25 
26 #include <string>
27 #include <vector>
28 
29 #include <boost/property_tree/ptree.hpp>
30 
31 #include "tgbot/net/HttpReqArg.h"
32 #include "tgbot/types/User.h"
33 #include "tgbot/types/Message.h"
35 #include "tgbot/types/InputFile.h"
37 #include "tgbot/types/Update.h"
39 #include "tgbot/types/Venue.h"
41 #include "tgbot/types/ChatMember.h"
42 #include "tgbot/types/StickerSet.h"
43 #include "tgbot/types/File.h"
44 #include "tgbot/types/InputMedia.h"
46 
47 namespace TgBot {
48 
49 class Bot;
50 
56 class Api {
57 
58 typedef std::shared_ptr<std::vector<std::string>> StringArrayPtr;
59 
60 friend class Bot;
61 
62 public:
63  Api(const std::string& token);
64 
69  User::Ptr getMe() const;
70 
82  Message::Ptr sendMessage(int64_t chatId, const std::string& text, bool disableWebPagePreview = false, int32_t replyToMessageId = 0,
83  const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const;
84 
93  Message::Ptr forwardMessage(int64_t chatId, int64_t fromChatId, int32_t messageId, bool disableNotification = false) const;
94 
106  Message::Ptr sendPhoto(int64_t chatId, const InputFile::Ptr photo, const std::string& caption = "", int32_t replyToMessageId = 0,
107  const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const;
108 
120  Message::Ptr sendPhoto(int64_t chatId, const std::string& photoId, const std::string& caption = "", int32_t replyToMessageId = 0,
121  const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const;
122 
137  Message::Ptr sendAudio(int64_t chatId, const InputFile::Ptr audio, const std::string &caption = "", int32_t duration = 0,
138  const std::string& performer = "", const std::string& title = "", int32_t replyToMessageId = 0,
139  const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const;
140 
155  Message::Ptr sendAudio(int64_t chatId, const std::string& audioId, const std::string &caption = "", int32_t duration = 0,
156  const std::string& performer = "", const std::string& title = "", int32_t replyToMessageId = 0,
157  const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const;
158 
170  Message::Ptr sendDocument(int64_t chatId, const InputFile::Ptr document, const std::string &caption = "", int32_t replyToMessageId = 0,
171  const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const;
172 
184  Message::Ptr sendDocument(int64_t chatId, const std::string& documentId, const std::string &caption = "", int32_t replyToMessageId = 0,
185  const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const;
186 
196  Message::Ptr sendSticker(int64_t chatId, const InputFile::Ptr sticker, int32_t replyToMessageId = 0,
197  const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), bool disableNotification = false) const;
198 
208  Message::Ptr sendSticker(int64_t chatId, const std::string& stickerId, int32_t replyToMessageId = 0,
209  const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), bool disableNotification = false) const;
210 
216  StickerSet::Ptr getStickerSet(const std::string& name) const;
217 
224  File::Ptr uploadStickerFile(int32_t userId, const InputFile::Ptr pngSticker) const;
225 
237  bool createNewStickerSet(int32_t userId, const std::string& name, const std::string& title,
238  InputFile::Ptr pngSticker, const std::string& emojis, bool containsMasks = false, MaskPosition::Ptr maskPosition = nullptr) const;
239 
251  bool createNewStickerSet(int32_t userId, const std::string& name, const std::string& title,
252  const std::string& pngSticker, const std::string& emojis, bool containsMasks = false, MaskPosition::Ptr maskPosition = nullptr) const;
253 
264  bool addStickerToSet(int32_t userId, const std::string& name, const std::string& title,
265  InputFile::Ptr pngSticker, const std::string& emojis, MaskPosition::Ptr maskPosition = nullptr) const;
266 
277  bool addStickerToSet(int32_t userId, const std::string& name, const std::string& title,
278  const std::string& pngSticker, const std::string& emojis, MaskPosition::Ptr maskPosition = nullptr) const;
279 
286  bool setStickerPositionInSet(const std::string& sticker, uint32_t position) const;
287 
293  bool deleteStickerPositionInSet(const std::string& sticker) const;
294 
310  Message::Ptr sendVideo(int64_t chatId, const InputFile::Ptr video, bool supportsStreaming = false, int32_t duration = 0, int32_t width = 0, int32_t height = 0, const std::string& caption = "",
311  int32_t replyToMessageId = 0, const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const;
312 
328  Message::Ptr sendVideo(int64_t chatId, const std::string& videoId, bool supportsStreaming = false, int32_t duration = 0, int32_t width = 0, int32_t height = 0, const std::string& caption = "",
329  int32_t replyToMessageId = 0, const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const;
330 
342  Message::Ptr sendVideoNote(int64_t chatId, const InputFile::Ptr videoNote, int64_t replyToMessageId = 0, bool disableNotification = false,
343  int32_t duration = 0, int32_t length = 0, const GenericReply::Ptr replyMarkup = GenericReply::Ptr());
344 
356  Message::Ptr sendVideoNote(int64_t chatId, const std::string& videoNote, int64_t replyToMessageId = 0, bool disableNotification = false,
357  int32_t duration = 0, int32_t length = 0, const GenericReply::Ptr replyMarkup = GenericReply::Ptr());
358 
367  std::vector<Message::Ptr> sendMediaGroup(int64_t chatId, const std::vector<InputMedia::Ptr>& media,
368  bool disableNotification = false, int32_t replyToMessageId = 0) const;
369 
382  Message::Ptr sendVoice(int64_t chatId, const InputFile::Ptr voice, const std::string& caption = "", int duration = 0, int32_t replyToMessageId = 0,
383  const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const;
384 
397  Message::Ptr sendVoice(int64_t chatId, const std::string& voiceId, const std::string& caption = "", int duration = 0, int32_t replyToMessageId = 0,
398  const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const;
399 
409  Message::Ptr sendGame(int64_t chatId, const std::string& gameShortName, int32_t replyToMessageId = 0,
410  const InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>(), bool disableNotification = false) const;
411 
423  Message::Ptr sendLocation(int64_t chatId, float latitude, float longitude, uint32_t livePeriod = 0,
424  int32_t replyToMessageId = 0, const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), bool disableNotification = false) const;
425 
436  Message::Ptr editMessageLiveLocation(float latitude, float longitude, int64_t chatId = 0, int32_t messageId = 0,
437  int32_t inlineMessageId = 0, const InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>()) const;
438 
447  Message::Ptr stopMessageLiveLocation(int64_t chatId = 0, int32_t messageId = 0, int32_t inlineMessageId = 0,
448  const InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>()) const;
449 
450 
464  Message::Ptr sendVenue(int64_t chatId, float latitude, float longitude, const std::string& title, const std::string& address, const std::string& foursquareId = "",
465  bool disableNotification = false, int32_t replyToMessageId = 0, const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>()) const;
466 
478  Message::Ptr sendContact(int64_t chatId, const std::string& phoneNumber, const std::string& firstName, const std::string& lastName = "", bool disableNotification = false,
479  int32_t replyToMessageId = 0, const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>()) const;
480 
490  void sendChatAction(int64_t chatId, const std::string& action) const;
491 
499  UserProfilePhotos::Ptr getUserProfilePhotos(int32_t userId, int32_t offset = 0, int32_t limit = 100) const;
500 
506  File::Ptr getFile(const std::string &fileId) const;
507 
513  bool leaveChat(int64_t chatId) const;
514 
520  Chat::Ptr getChat(int64_t chatId) const;
521 
527  std::vector<ChatMember::Ptr> getChatAdministrators(int64_t chatId) const;
528 
534  int32_t getChatMembersCount(int64_t chatId) const;
535 
542  ChatMember::Ptr getChatMember(int64_t chatId, int32_t userId) const;
543 
550  bool setChatStickerSet(int64_t chatId, const std::string& stickerSetName) const;
551 
557  bool deleteChatStickerSet(int64_t chatId) const;
558 
559 
569  bool answerCallbackQuery(const std::string & callbackQueryId, const std::string & text="", bool showAlert=false, const std::string &url="", int32_t cacheTime=0) const;
570 
582  Message::Ptr editMessageText(const std::string& text, int64_t chatId=0, int32_t messageId=0, const std::string& inlineMessageId="",
583  const std::string& parseMode = "", bool disableWebPagePreview = false, const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>()) const;
584 
594  Message::Ptr editMessageCaption(int64_t chatId = 0, int32_t messageId = 0, const std::string& caption = "",
595  const std::string& inlineMessageId = "", const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>()) const;
596 
605  Message::Ptr editMessageReplyMarkup(int64_t chatId = 0, int32_t messageId = 0, const std::string& inlineMessageId = "",
606  const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>()) const;
607 
613  void deleteMessage(int64_t chatId, int32_t messageId) const;
614 
627  std::vector<Update::Ptr> getUpdates(int32_t offset = 0, int32_t limit = 100, int32_t timeout = 0, const StringArrayPtr &allowedUpdates = nullptr) const;
628 
639  void setWebhook(const std::string& url = "", const InputFile::Ptr certificate = nullptr, int32_t maxConnection = 40, const StringArrayPtr &allowedUpdates = nullptr) const;
640 
648  bool deleteWebhook() const;
649 
659 
672  bool answerInlineQuery(const std::string& inlineQueryId, const std::vector<InlineQueryResult::Ptr>& results,
673  int32_t cacheTime = 300, bool isPersonal = false, const std::string& nextOffset = "", const std::string& switchPmText = "", const std::string& switchPmParameter = "") const;
674 
682  bool kickChatMember(int64_t chatId, int32_t userId, uint64_t untilDate = 0) const;
683 
690  bool unbanChatMember(int64_t chatId, int32_t userId) const;
691 
703  bool restrictChatMember(int64_t chatId, int32_t userId, uint64_t untilDate = 0, bool canSendMessages = false,
704  bool canSendMediaMessages = false, bool canSendOtherMessages = false, bool canAddWebPagePreviews = false) const;
705 
720  bool promoteChatMember(int64_t chatId, int32_t userId, bool canChangeInfo = false, bool canPostMessages = false,
721  bool canEditMessages = false, bool canDeleteMessages = false, bool canInviteUsers = false, bool canPinMessages = false, bool canPromoteMembers = false) const;
722 
728  std::string exportChatInviteLink(int64_t chatId) const;
729 
739  bool setChatPhoto(int64_t chatId, const InputFile::Ptr photo) const;
740 
749  bool deleteChatPhoto(int64_t chatId) const;
750 
760  bool setChatTitle(int64_t chatId, const std::string& title) const;
761 
768  bool setChatDescription(int64_t chatId, const std::string& description) const;
769 
777  bool pinChatMessage(int64_t chatId, int32_t messageId, bool disableNotification = false) const;
778 
784  bool unpinChatMessage(int64_t chatId) const;
785 
800  Message::Ptr setGameScore(int32_t userId, int32_t score, bool force = false, bool disableEditMessage = false,
801  int64_t chatId = 0, int32_t messageId = 0, const std::string& inlineMessageId = "") const;
802 
814  std::vector<GameHighScore::Ptr> getGameHighScores(int32_t userId, int32_t score, bool force = false,
815  bool disableEditMessage = false, int64_t chatId = 0, int32_t messageId = 0, const std::string& inlineMessageId = "") const;
816 
817 
824  std::string downloadFile(const std::string& filePath, const std::vector<HttpReqArg>& args = std::vector<HttpReqArg>()) const;
825 
826 private:
827  boost::property_tree::ptree sendRequest(const std::string& method, const std::vector<HttpReqArg>& args = std::vector<HttpReqArg>()) const;
828 
829  const std::string _token;
830 };
831 
832 }
833 
834 #endif //TGBOT_CPP_API_H
Chat::Ptr getChat(int64_t chatId) const
Use this method to get up to date information about the chat (current name of the user for one-on-one...
Message::Ptr sendVoice(int64_t chatId, const InputFile::Ptr voice, const std::string &caption="", int duration=0, int32_t replyToMessageId=0, const GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >(), const std::string &parseMode="", bool disableNotification=false) const
Use this method to send audio files, if you want Telegram clients to display the file as a playable v...
std::shared_ptr< StickerSet > Ptr
Definition: StickerSet.h:42
std::shared_ptr< File > Ptr
Definition: File.h:26
bool promoteChatMember(int64_t chatId, int32_t userId, bool canChangeInfo=false, bool canPostMessages=false, bool canEditMessages=false, bool canDeleteMessages=false, bool canInviteUsers=false, bool canPinMessages=false, bool canPromoteMembers=false) const
Use this method to promote or demote a user in a supergroup or a channel.
bool unpinChatMessage(int64_t chatId) const
Use this method to unpin a message in a supergroup or a channel.
std::string downloadFile(const std::string &filePath, const std::vector< HttpReqArg > &args=std::vector< HttpReqArg >()) const
Downloads file from Telegram and saves it in memory.
std::vector< Update::Ptr > getUpdates(int32_t offset=0, int32_t limit=100, int32_t timeout=0, const StringArrayPtr &allowedUpdates=nullptr) const
Use this method to receive incoming updates using long polling.
Message::Ptr sendPhoto(int64_t chatId, const InputFile::Ptr photo, const std::string &caption="", int32_t replyToMessageId=0, const GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >(), const std::string &parseMode="", bool disableNotification=false) const
Use this method to send photos.
File::Ptr getFile(const std::string &fileId) const
Use this method to get basic info about a file and prepare it for downloading. For the moment...
bool setChatDescription(int64_t chatId, const std::string &description) const
Use this method to change the description of a supergroup or a channel.
Definition: Api.h:47
bool setChatTitle(int64_t chatId, const std::string &title) const
Use this method to change the title of a chat.
bool kickChatMember(int64_t chatId, int32_t userId, uint64_t untilDate=0) const
Use this method to kick a user from a group or a supergroup.
bool createNewStickerSet(int32_t userId, const std::string &name, const std::string &title, InputFile::Ptr pngSticker, const std::string &emojis, bool containsMasks=false, MaskPosition::Ptr maskPosition=nullptr) const
Use this method to create new sticker set owned by a user. The bot will be able to edit the created s...
Message::Ptr sendContact(int64_t chatId, const std::string &phoneNumber, const std::string &firstName, const std::string &lastName="", bool disableNotification=false, int32_t replyToMessageId=0, const GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >()) const
Use this method to send phone contacts. On success, the sent Message is returned. ...
bool addStickerToSet(int32_t userId, const std::string &name, const std::string &title, InputFile::Ptr pngSticker, const std::string &emojis, MaskPosition::Ptr maskPosition=nullptr) const
Use this method to add a new sticker to a set created by the bot.
bool answerCallbackQuery(const std::string &callbackQueryId, const std::string &text="", bool showAlert=false, const std::string &url="", int32_t cacheTime=0) const
Use this method to send answers to callback queries sent from inline keyboards. The answer will be di...
std::shared_ptr< InlineKeyboardMarkup > Ptr
Message::Ptr sendSticker(int64_t chatId, const InputFile::Ptr sticker, int32_t replyToMessageId=0, const GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >(), bool disableNotification=false) const
Use this method to send .webp stickers.
This class executes telegram api methods. Telegram docs: https://core.telegram.org/bots/api#available...
Definition: Api.h:56
bool setChatStickerSet(int64_t chatId, const std::string &stickerSetName) const
Use this method to get information about a member of a chat. Returns a ChatMember object on success...
std::shared_ptr< Message > Ptr
Definition: Message.h:54
bool pinChatMessage(int64_t chatId, int32_t messageId, bool disableNotification=false) const
Use this method to pin a message in a supergroup or a channel.
User::Ptr getMe() const
A simple method for testing your bot&#39;s auth token.
bool deleteStickerPositionInSet(const std::string &sticker) const
Use this method to delete a sticker from a set created by the bot.
void deleteMessage(int64_t chatId, int32_t messageId) const
Use this method to delete messages sent by bot (or by other users if bot is admin).
bool deleteChatStickerSet(int64_t chatId) const
Use this method to get information about a member of a chat. Returns a ChatMember object on success...
Message::Ptr sendAudio(int64_t chatId, const InputFile::Ptr audio, const std::string &caption="", int32_t duration=0, const std::string &performer="", const std::string &title="", int32_t replyToMessageId=0, const GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >(), const std::string &parseMode="", bool disableNotification=false) const
Use this method to send audio files, if you want Telegram clients to display the file as a playable v...
std::shared_ptr< UserProfilePhotos > Ptr
std::shared_ptr< WebhookInfo > Ptr
Definition: WebhookInfo.h:21
WebhookInfo::Ptr getWebhookInfo() const
Use this method to get current webhook status.
Message::Ptr setGameScore(int32_t userId, int32_t score, bool force=false, bool disableEditMessage=false, int64_t chatId=0, int32_t messageId=0, const std::string &inlineMessageId="") const
Use this method to set the score of the specified user in a game.
This object holds other objects specific for this bot instance.
Definition: Bot.h:39
bool unbanChatMember(int64_t chatId, int32_t userId) const
Use this method to unban a previously kicked user in a supergroup.
Message::Ptr sendDocument(int64_t chatId, const InputFile::Ptr document, const std::string &caption="", int32_t replyToMessageId=0, const GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >(), const std::string &parseMode="", bool disableNotification=false) const
Use this method to send general files.
int32_t getChatMembersCount(int64_t chatId) const
Use this method to get the number of members in a chat. Returns Int on success.
std::shared_ptr< GenericReply > Ptr
Definition: GenericReply.h:37
Message::Ptr editMessageReplyMarkup(int64_t chatId=0, int32_t messageId=0, const std::string &inlineMessageId="", const GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >()) const
Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline ...
std::shared_ptr< InputFile > Ptr
Definition: InputFile.h:40
Message::Ptr forwardMessage(int64_t chatId, int64_t fromChatId, int32_t messageId, bool disableNotification=false) const
Use this method to forward messages of any kind.
Message::Ptr sendLocation(int64_t chatId, float latitude, float longitude, uint32_t livePeriod=0, int32_t replyToMessageId=0, const GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >(), bool disableNotification=false) const
Use this method to send point on the map.
std::shared_ptr< Chat > Ptr
Definition: Chat.h:41
Message::Ptr sendVideoNote(int64_t chatId, const InputFile::Ptr videoNote, int64_t replyToMessageId=0, bool disableNotification=false, int32_t duration=0, int32_t length=0, const GenericReply::Ptr replyMarkup=GenericReply::Ptr())
Use this method to send video messages. On success, the sent Message is returned. ...
Message::Ptr editMessageLiveLocation(float latitude, float longitude, int64_t chatId=0, int32_t messageId=0, int32_t inlineMessageId=0, const InlineKeyboardMarkup::Ptr replyMarkup=std::make_shared< InlineKeyboardMarkup >()) const
Use this method to edit live location messages sent by the bot or via the bot (for inline bots)...
bool leaveChat(int64_t chatId) const
Use this method for your bot to leave a group, supergroup or channel.
void sendChatAction(int64_t chatId, const std::string &action) const
Use this method when you need to tell the user that something is happening on the bot&#39;s side...
File::Ptr uploadStickerFile(int32_t userId, const InputFile::Ptr pngSticker) const
Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStic...
bool answerInlineQuery(const std::string &inlineQueryId, const std::vector< InlineQueryResult::Ptr > &results, int32_t cacheTime=300, bool isPersonal=false, const std::string &nextOffset="", const std::string &switchPmText="", const std::string &switchPmParameter="") const
Use this method to send answers to an inline query. No mode that 50 results per query are allowed...
ChatMember::Ptr getChatMember(int64_t chatId, int32_t userId) const
Use this method to get information about a member of a chat. Returns a ChatMember object on success...
bool setChatPhoto(int64_t chatId, const InputFile::Ptr photo) const
Use this method to set a new profile photo for the chat.
Message::Ptr sendVideo(int64_t chatId, const InputFile::Ptr video, bool supportsStreaming=false, int32_t duration=0, int32_t width=0, int32_t height=0, const std::string &caption="", int32_t replyToMessageId=0, const GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >(), const std::string &parseMode="", bool disableNotification=false) const
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent a...
std::vector< Message::Ptr > sendMediaGroup(int64_t chatId, const std::vector< InputMedia::Ptr > &media, bool disableNotification=false, int32_t replyToMessageId=0) const
Use this method to send a group of photos or videos as an album.
bool deleteWebhook() const
Use this method to remove webhook integration if you decide to switch back to getUpdates.
std::shared_ptr< MaskPosition > Ptr
Definition: MaskPosition.h:39
bool deleteChatPhoto(int64_t chatId) const
Use this method to delete a chat photo.
Message::Ptr sendGame(int64_t chatId, const std::string &gameShortName, int32_t replyToMessageId=0, const InlineKeyboardMarkup::Ptr replyMarkup=std::make_shared< InlineKeyboardMarkup >(), bool disableNotification=false) const
Use this method to send a game.
Api(const std::string &token)
StickerSet::Ptr getStickerSet(const std::string &name) const
Use this method to get a sticker set.
Message::Ptr sendVenue(int64_t chatId, float latitude, float longitude, const std::string &title, const std::string &address, const std::string &foursquareId="", bool disableNotification=false, int32_t replyToMessageId=0, const GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >()) const
Use this method to send information about a venue. On success, the sent Message is returned...
Message::Ptr sendMessage(int64_t chatId, const std::string &text, bool disableWebPagePreview=false, int32_t replyToMessageId=0, const GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >(), const std::string &parseMode="", bool disableNotification=false) const
Use this method to send text messages.
std::vector< GameHighScore::Ptr > getGameHighScores(int32_t userId, int32_t score, bool force=false, bool disableEditMessage=false, int64_t chatId=0, int32_t messageId=0, const std::string &inlineMessageId="") const
Use this method to get data for high score tables.
std::vector< ChatMember::Ptr > getChatAdministrators(int64_t chatId) const
Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember...
Message::Ptr stopMessageLiveLocation(int64_t chatId=0, int32_t messageId=0, int32_t inlineMessageId=0, const InlineKeyboardMarkup::Ptr replyMarkup=std::make_shared< InlineKeyboardMarkup >()) const
Use this method to edit live location messages sent by the bot or via the bot (for inline bots)...
Message::Ptr editMessageCaption(int64_t chatId=0, int32_t messageId=0, const std::string &caption="", const std::string &inlineMessageId="", const GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >()) const
Use this method to edit captions of messages sent by the bot or via the bot (for inline bots)...
bool restrictChatMember(int64_t chatId, int32_t userId, uint64_t untilDate=0, bool canSendMessages=false, bool canSendMediaMessages=false, bool canSendOtherMessages=false, bool canAddWebPagePreviews=false) const
Use this method to restrict a user in a supergroup.
UserProfilePhotos::Ptr getUserProfilePhotos(int32_t userId, int32_t offset=0, int32_t limit=100) const
Use this method to get a list of profile pictures for a user.
std::string exportChatInviteLink(int64_t chatId) const
Use this method to generate a new invite link for a chat; any previously generated link is revoked...
std::shared_ptr< ChatMember > Ptr
Definition: ChatMember.h:22
void setWebhook(const std::string &url="", const InputFile::Ptr certificate=nullptr, int32_t maxConnection=40, const StringArrayPtr &allowedUpdates=nullptr) const
Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts.
Message::Ptr editMessageText(const std::string &text, int64_t chatId=0, int32_t messageId=0, const std::string &inlineMessageId="", const std::string &parseMode="", bool disableWebPagePreview=false, const GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >()) const
Use this method to edit text and game messages sent by the bot or via the bot (for inline bots) ...
bool setStickerPositionInSet(const std::string &sticker, uint32_t position) const
Use this method to move a sticker in a set created by the bot to a specific position.
std::shared_ptr< User > Ptr
Definition: User.h:39