tgbot-cpp
Loading...
Searching...
No Matches
Api.h
Go to the documentation of this file.
1#ifndef TGBOT_API_H
2#define TGBOT_API_H
3
4#include "tgbot/TgException.h"
9#include "tgbot/types/User.h"
10#include "tgbot/types/Message.h"
15#include "tgbot/types/Update.h"
17#include "tgbot/types/Venue.h"
21#include "tgbot/types/File.h"
29
30#include <boost/property_tree/ptree.hpp>
31#include <boost/variant.hpp>
32
33#include <cstdint>
34#include <memory>
35#include <string>
36#include <utility>
37#include <vector>
38
39namespace TgBot {
40
41class Bot;
42
48class TGBOT_API Api {
49
50typedef std::shared_ptr<std::vector<std::string>> StringArrayPtr;
51
52friend class Bot;
53
54public:
55 Api(std::string token, const HttpClient& httpClient, const std::string& url);
56
70 std::vector<Update::Ptr> getUpdates(std::int32_t offset = 0,
71 std::int32_t limit = 100,
72 std::int32_t timeout = 0,
73 const StringArrayPtr& allowedUpdates = nullptr) const;
74
103 bool setWebhook(const std::string& url,
104 InputFile::Ptr certificate = nullptr,
105 std::int32_t maxConnections = 40,
106 const StringArrayPtr& allowedUpdates = nullptr,
107 const std::string& ipAddress = "",
108 bool dropPendingUpdates = false,
109 const std::string& secretToken = "") const;
110
118 bool deleteWebhook(bool dropPendingUpdates = false) const;
119
129
138
148 bool logOut() const;
149
159 bool close() const;
160
179 Message::Ptr sendMessage(boost::variant<std::int64_t, std::string> chatId,
180 const std::string& text,
181 bool disableWebPagePreview = false,
182 std::int32_t replyToMessageId = 0,
183 GenericReply::Ptr replyMarkup = nullptr,
184 const std::string& parseMode = "",
185 bool disableNotification = false,
186 const std::vector<MessageEntity::Ptr>& entities = std::vector<MessageEntity::Ptr>(),
187 bool allowSendingWithoutReply = false,
188 bool protectContent = false,
189 std::int32_t messageThreadId = 0) const;
190
205 Message::Ptr forwardMessage(boost::variant<std::int64_t, std::string> chatId,
206 boost::variant<std::int64_t, std::string> fromChatId,
207 std::int32_t messageId,
208 bool disableNotification = false,
209 bool protectContent = false,
210 std::int32_t messageThreadId = 0) const;
211
234 MessageId::Ptr copyMessage(boost::variant<std::int64_t, std::string> chatId,
235 boost::variant<std::int64_t, std::string> fromChatId,
236 std::int32_t messageId,
237 const std::string& caption = "",
238 const std::string& parseMode = "",
239 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
240 bool disableNotification = false,
241 std::int32_t replyToMessageId = 0,
242 bool allowSendingWithoutReply = false,
243 GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
244 bool protectContent = false,
245 std::int32_t messageThreadId = 0) const;
246
265 Message::Ptr sendPhoto(boost::variant<std::int64_t, std::string> chatId,
266 boost::variant<InputFile::Ptr, std::string> photo,
267 const std::string& caption = "",
268 std::int32_t replyToMessageId = 0,
269 GenericReply::Ptr replyMarkup = nullptr,
270 const std::string& parseMode = "",
271 bool disableNotification = false,
272 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
273 bool allowSendingWithoutReply = false,
274 bool protectContent = false,
275 std::int32_t messageThreadId = 0,
276 bool hasSpoiler = false) const;
277
304 Message::Ptr sendAudio(boost::variant<std::int64_t, std::string> chatId,
305 boost::variant<InputFile::Ptr, std::string> audio,
306 const std::string& caption = "",
307 std::int32_t duration = 0,
308 const std::string& performer = "",
309 const std::string& title = "",
310 boost::variant<InputFile::Ptr, std::string> thumb = "",
311 std::int32_t replyToMessageId = 0,
312 GenericReply::Ptr replyMarkup = nullptr,
313 const std::string& parseMode = "",
314 bool disableNotification = false,
315 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
316 bool allowSendingWithoutReply = false,
317 bool protectContent = false,
318 std::int32_t messageThreadId = 0) const;
319
341 Message::Ptr sendDocument(boost::variant<std::int64_t, std::string> chatId,
342 boost::variant<InputFile::Ptr, std::string> document,
343 boost::variant<InputFile::Ptr, std::string> thumb = "",
344 const std::string& caption = "",
345 std::int32_t replyToMessageId = 0,
346 GenericReply::Ptr replyMarkup = nullptr,
347 const std::string& parseMode = "",
348 bool disableNotification = false,
349 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
350 bool disableContentTypeDetection = false,
351 bool allowSendingWithoutReply = false,
352 bool protectContent = false,
353 std::int32_t messageThreadId = 0) const;
354
380 Message::Ptr sendVideo(boost::variant<std::int64_t, std::string> chatId,
381 boost::variant<InputFile::Ptr, std::string> video,
382 bool supportsStreaming = false,
383 std::int32_t duration = 0,
384 std::int32_t width = 0,
385 std::int32_t height = 0,
386 boost::variant<InputFile::Ptr, std::string> thumb = "",
387 const std::string& caption = "",
388 std::int32_t replyToMessageId = 0,
389 GenericReply::Ptr replyMarkup = nullptr,
390 const std::string& parseMode = "",
391 bool disableNotification = false,
392 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
393 bool allowSendingWithoutReply = false,
394 bool protectContent = false,
395 std::int32_t messageThreadId = 0,
396 bool hasSpoiler = false) const;
397
422 Message::Ptr sendAnimation(boost::variant<std::int64_t, std::string> chatId,
423 boost::variant<InputFile::Ptr, std::string> animation,
424 std::int32_t duration = 0,
425 std::int32_t width = 0,
426 std::int32_t height = 0,
427 boost::variant<InputFile::Ptr, std::string> thumb = "",
428 const std::string& caption = "",
429 std::int32_t replyToMessageId = 0,
430 GenericReply::Ptr replyMarkup = nullptr,
431 const std::string& parseMode = "",
432 bool disableNotification = false,
433 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
434 bool allowSendingWithoutReply = false,
435 bool protectContent = false,
436 std::int32_t messageThreadId = 0,
437 bool hasSpoiler = false) const;
438
460 Message::Ptr sendVoice(boost::variant<std::int64_t, std::string> chatId,
461 boost::variant<InputFile::Ptr, std::string> voice,
462 const std::string& caption = "",
463 std::int32_t duration = 0,
464 std::int32_t replyToMessageId = 0,
465 GenericReply::Ptr replyMarkup = nullptr,
466 const std::string& parseMode = "",
467 bool disableNotification = false,
468 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
469 bool allowSendingWithoutReply = false,
470 bool protectContent = false,
471 std::int32_t messageThreadId = 0) const;
472
492 Message::Ptr sendVideoNote(boost::variant<std::int64_t, std::string> chatId,
493 boost::variant<InputFile::Ptr, std::string> videoNote,
494 std::int64_t replyToMessageId = 0,
495 bool disableNotification = false,
496 std::int32_t duration = 0,
497 std::int32_t length = 0,
498 boost::variant<InputFile::Ptr, std::string> thumb = "",
499 GenericReply::Ptr replyMarkup = nullptr,
500 bool allowSendingWithoutReply = false,
501 bool protectContent = false,
502 std::int32_t messageThreadId = 0) const;
503
519 std::vector<Message::Ptr> sendMediaGroup(boost::variant<std::int64_t, std::string> chatId,
520 const std::vector<InputMedia::Ptr>& media,
521 bool disableNotification = false,
522 std::int32_t replyToMessageId = 0,
523 bool allowSendingWithoutReply = false,
524 bool protectContent = false,
525 std::int32_t messageThreadId = 0) const;
526
546 Message::Ptr sendLocation(boost::variant<std::int64_t, std::string> chatId,
547 float latitude,
548 float longitude,
549 std::int32_t livePeriod = 0,
550 std::int32_t replyToMessageId = 0,
551 GenericReply::Ptr replyMarkup = nullptr,
552 bool disableNotification = false,
553 float horizontalAccuracy = 0,
554 std::int32_t heading = 0,
555 std::int32_t proximityAlertRadius = 0,
556 bool allowSendingWithoutReply = false,
557 bool protectContent = false,
558 std::int32_t messageThreadId = 0) const;
559
578 float longitude,
579 boost::variant<std::int64_t, std::string> chatId = "",
580 std::int32_t messageId = 0,
581 const std::string& inlineMessageId = "",
582 InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>(),
583 float horizontalAccuracy = 0,
584 std::int32_t heading = 0,
585 std::int32_t proximityAlertRadius = 0) const;
586
597 Message::Ptr stopMessageLiveLocation(boost::variant<std::int64_t, std::string> chatId = "",
598 std::int32_t messageId = 0,
599 const std::string& inlineMessageId = "",
600 InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>()) const;
601
623 Message::Ptr sendVenue(boost::variant<std::int64_t, std::string> chatId,
624 float latitude,
625 float longitude,
626 const std::string& title,
627 const std::string& address,
628 const std::string& foursquareId = "",
629 const std::string& foursquareType = "",
630 bool disableNotification = false,
631 std::int32_t replyToMessageId = 0,
632 GenericReply::Ptr replyMarkup = nullptr,
633 const std::string& googlePlaceId = "",
634 const std::string& googlePlaceType = "",
635 bool allowSendingWithoutReply = false,
636 bool protectContent = false,
637 std::int32_t messageThreadId = 0) const;
638
656 Message::Ptr sendContact(boost::variant<std::int64_t, std::string> chatId,
657 const std::string& phoneNumber,
658 const std::string& firstName,
659 const std::string& lastName = "",
660 const std::string& vcard = "",
661 bool disableNotification = false,
662 std::int32_t replyToMessageId = 0,
663 GenericReply::Ptr replyMarkup = nullptr,
664 bool allowSendingWithoutReply = false,
665 bool protectContent = false,
666 std::int32_t messageThreadId = 0) const;
667
693 Message::Ptr sendPoll(boost::variant<std::int64_t, std::string> chatId,
694 const std::string& question,
695 const std::vector<std::string>& options,
696 bool disableNotification = false,
697 std::int32_t replyToMessageId = 0,
698 GenericReply::Ptr replyMarkup = nullptr,
699 bool isAnonymous = true,
700 const std::string& type = "",
701 bool allowsMultipleAnswers = false,
702 std::int32_t correctOptionId = -1,
703 const std::string& explanation = "",
704 const std::string& explanationParseMode = "",
705 const std::vector<MessageEntity::Ptr>& explanationEntities = std::vector<MessageEntity::Ptr>(),
706 std::int32_t openPeriod = 0,
707 std::int32_t closeDate = 0,
708 bool isClosed = false,
709 bool allowSendingWithoutReply = false,
710 bool protectContent = false,
711 std::int32_t messageThreadId = 0) const;
712
727 Message::Ptr sendDice(boost::variant<std::int64_t, std::string> chatId,
728 bool disableNotification = false,
729 std::int32_t replyToMessageId = 0,
730 GenericReply::Ptr replyMarkup = nullptr,
731 const std::string& emoji = "",
732 bool allowSendingWithoutReply = false,
733 bool protectContent = false,
734 std::int32_t messageThreadId = 0) const;
735
752 bool sendChatAction(std::int64_t chatId,
753 const std::string& action,
754 std::int32_t messageThreadId = 0) const;
755
766 std::int32_t offset = 0,
767 std::int32_t limit = 100) const;
768
784 File::Ptr getFile(const std::string& fileId) const;
785
799 bool banChatMember(boost::variant<std::int64_t, std::string> chatId,
800 std::int64_t userId,
801 std::int32_t untilDate = 0,
802 bool revokeMessages = true) const;
803
819 bool unbanChatMember(boost::variant<std::int64_t, std::string> chatId,
820 std::int64_t userId,
821 bool onlyIfBanned = false) const;
822
837 bool restrictChatMember(boost::variant<std::int64_t, std::string> chatId,
838 std::int64_t userId,
839 ChatPermissions::Ptr permissions,
840 std::int64_t untilDate = 0,
841 bool useIndependentChatPermissions = false) const;
842
866 bool promoteChatMember(boost::variant<std::int64_t, std::string> chatId,
867 std::int64_t userId,
868 bool canChangeInfo = false,
869 bool canPostMessages = false,
870 bool canEditMessages = false,
871 bool canDeleteMessages = false,
872 bool canInviteUsers = false,
873 bool canPinMessages = false,
874 bool canPromoteMembers = false,
875 bool isAnonymous = false,
876 bool canManageChat = false,
877 bool canManageVideoChats = false,
878 bool canRestrictMembers = false,
879 bool canManageTopics = false) const;
880
890 bool setChatAdministratorCustomTitle(boost::variant<std::int64_t, std::string> chatId,
891 std::int64_t userId,
892 const std::string& customTitle) const;
893
905 bool banChatSenderChat(boost::variant<std::int64_t, std::string> chatId,
906 std::int64_t senderChatId) const;
907
918 bool unbanChatSenderChat(boost::variant<std::int64_t, std::string> chatId,
919 std::int64_t senderChatId) const;
920
932 bool setChatPermissions(boost::variant<std::int64_t, std::string> chatId,
933 ChatPermissions::Ptr permissions,
934 bool useIndependentChatPermissions = false) const;
935
950 std::string exportChatInviteLink(boost::variant<std::int64_t, std::string> chatId) const;
951
966 ChatInviteLink::Ptr createChatInviteLink(boost::variant<std::int64_t, std::string> chatId,
967 std::int32_t expireDate = 0,
968 std::int32_t memberLimit = 0,
969 const std::string& name = "",
970 bool createsJoinRequest = false) const;
971
986 ChatInviteLink::Ptr editChatInviteLink(boost::variant<std::int64_t, std::string> chatId,
987 const std::string& inviteLink,
988 std::int32_t expireDate = 0,
989 std::int32_t memberLimit = 0,
990 const std::string& name = "",
991 bool createsJoinRequest = false) const;
992
1004 ChatInviteLink::Ptr revokeChatInviteLink(boost::variant<std::int64_t, std::string> chatId,
1005 const std::string& inviteLink) const;
1006
1017 bool approveChatJoinRequest(boost::variant<std::int64_t, std::string> chatId,
1018 std::int64_t userId) const;
1019
1030 bool declineChatJoinRequest(boost::variant<std::int64_t, std::string> chatId,
1031 std::int64_t userId) const;
1032
1044 bool setChatPhoto(boost::variant<std::int64_t, std::string> chatId,
1045 InputFile::Ptr photo) const;
1046
1057 bool deleteChatPhoto(boost::variant<std::int64_t, std::string> chatId) const;
1058
1070 bool setChatTitle(boost::variant<std::int64_t, std::string> chatId,
1071 const std::string& title) const;
1072
1083 bool setChatDescription(boost::variant<std::int64_t, std::string> chatId,
1084 const std::string& description = "") const;
1085
1097 bool pinChatMessage(boost::variant<std::int64_t, std::string> chatId,
1098 std::int32_t messageId,
1099 bool disableNotification = false) const;
1100
1111 bool unpinChatMessage(boost::variant<std::int64_t, std::string> chatId,
1112 std::int32_t messageId = 0) const;
1113
1123 bool unpinAllChatMessages(boost::variant<std::int64_t, std::string> chatId) const;
1124
1132 bool leaveChat(boost::variant<std::int64_t, std::string> chatId) const;
1133
1141 Chat::Ptr getChat(boost::variant<std::int64_t, std::string> chatId) const;
1142
1150 std::vector<ChatMember::Ptr> getChatAdministrators(boost::variant<std::int64_t, std::string> chatId) const;
1151
1159 std::int32_t getChatMemberCount(boost::variant<std::int64_t, std::string> chatId) const;
1160
1171 ChatMember::Ptr getChatMember(boost::variant<std::int64_t, std::string> chatId,
1172 std::int64_t userId) const;
1173
1185 bool setChatStickerSet(boost::variant<std::int64_t, std::string> chatId,
1186 const std::string& stickerSetName) const;
1187
1198 bool deleteChatStickerSet(boost::variant<std::int64_t, std::string> chatId) const;
1199
1205 std::vector<Sticker::Ptr> getForumTopicIconStickers() const;
1206
1219 ForumTopic::Ptr createForumTopic(boost::variant<std::int64_t, std::string> chatId,
1220 const std::string& name,
1221 std::int32_t iconColor = 0,
1222 const std::string& iconCustomEmojiId = "") const;
1223
1236 bool editForumTopic(boost::variant<std::int64_t, std::string> chatId,
1237 std::int32_t messageThreadId,
1238 const std::string& name = "",
1239 boost::variant<std::int8_t, std::string> iconCustomEmojiId = 0) const;
1240
1251 bool closeForumTopic(boost::variant<std::int64_t, std::string> chatId,
1252 std::int32_t messageThreadId) const;
1253
1264 bool reopenForumTopic(boost::variant<std::int64_t, std::string> chatId,
1265 std::int32_t messageThreadId) const;
1266
1277 bool deleteForumTopic(boost::variant<std::int64_t, std::string> chatId,
1278 std::int32_t messageThreadId) const;
1279
1290 bool unpinAllForumTopicMessages(boost::variant<std::int64_t, std::string> chatId,
1291 std::int32_t messageThreadId) const;
1292
1303 bool editGeneralForumTopic(boost::variant<std::int64_t, std::string> chatId,
1304 std::string name) const;
1305
1315 bool closeGeneralForumTopic(boost::variant<std::int64_t, std::string> chatId) const;
1316
1327 bool reopenGeneralForumTopic(boost::variant<std::int64_t, std::string> chatId) const;
1328
1339 bool hideGeneralForumTopic(boost::variant<std::int64_t, std::string> chatId) const;
1340
1350 bool unhideGeneralForumTopic(boost::variant<std::int64_t, std::string> chatId) const;
1351
1369 bool answerCallbackQuery(const std::string& callbackQueryId,
1370 const std::string& text = "",
1371 bool showAlert = false,
1372 const std::string& url = "",
1373 std::int32_t cacheTime = 0) const;
1374
1386 bool setMyCommands(const std::vector<BotCommand::Ptr>& commands,
1387 BotCommandScope::Ptr scope = nullptr,
1388 const std::string& languageCode = "") const;
1389
1401 const std::string& languageCode = "") const;
1402
1411 std::vector<BotCommand::Ptr> getMyCommands(BotCommandScope::Ptr scope = nullptr,
1412 const std::string& languageCode = "") const;
1413
1422 bool setChatMenuButton(std::int64_t chatId = 0,
1423 MenuButton::Ptr menuButton = nullptr) const;
1424
1432 MenuButton::Ptr getChatMenuButton(std::int64_t chatId = 0) const;
1433
1445 bool forChannels = false) const;
1446
1455
1470 Message::Ptr editMessageText(const std::string& text,
1471 boost::variant<std::int64_t, std::string> chatId = 0,
1472 std::int32_t messageId = 0,
1473 const std::string& inlineMessageId = "",
1474 const std::string& parseMode = "",
1475 bool disableWebPagePreview = false,
1476 GenericReply::Ptr replyMarkup = nullptr,
1477 const std::vector<MessageEntity::Ptr>& entities = std::vector<MessageEntity::Ptr>()) const;
1478
1492 Message::Ptr editMessageCaption(boost::variant<std::int64_t, std::string> chatId = 0,
1493 std::int32_t messageId = 0,
1494 const std::string& caption = "",
1495 const std::string& inlineMessageId = "",
1496 GenericReply::Ptr replyMarkup = nullptr,
1497 const std::string& parseMode = "",
1498 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>()) const;
1499
1515 boost::variant<std::int64_t, std::string> chatId = 0,
1516 std::int32_t messageId = 0,
1517 const std::string& inlineMessageId = "",
1518 GenericReply::Ptr replyMarkup = nullptr) const;
1519
1530 Message::Ptr editMessageReplyMarkup(boost::variant<std::int64_t, std::string> chatId = 0,
1531 std::int32_t messageId = 0,
1532 const std::string& inlineMessageId = "",
1533 GenericReply::Ptr replyMarkup = nullptr) const;
1534
1544 Poll::Ptr stopPoll(boost::variant<std::int64_t, std::string> chatId,
1545 std::int64_t messageId,
1546 InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>()) const;
1547
1565 bool deleteMessage(boost::variant<std::int64_t, std::string> chatId,
1566 std::int32_t messageId) const;
1567
1582 Message::Ptr sendSticker(boost::variant<std::int64_t, std::string> chatId,
1583 boost::variant<InputFile::Ptr, std::string> sticker,
1584 std::int32_t replyToMessageId = 0,
1585 GenericReply::Ptr replyMarkup = nullptr,
1586 bool disableNotification = false,
1587 bool allowSendingWithoutReply = false,
1588 bool protectContent = false,
1589 std::int32_t messageThreadId = 0) const;
1590
1598 StickerSet::Ptr getStickerSet(const std::string& name) const;
1599
1607 std::vector<Sticker::Ptr> getCustomEmojiStickers(const std::vector<std::string>& customEmojiIds) const;
1608
1617 File::Ptr uploadStickerFile(std::int64_t userId,
1618 InputFile::Ptr pngSticker) const;
1619
1638 bool createNewStickerSet(std::int64_t userId,
1639 const std::string& name,
1640 const std::string& title,
1641 const std::string& emojis,
1642 MaskPosition::Ptr maskPosition = nullptr,
1643 boost::variant<InputFile::Ptr, std::string> pngSticker = "",
1644 InputFile::Ptr tgsSticker = nullptr,
1645 InputFile::Ptr webmSticker = nullptr,
1646 const std::string& stickerType = "") const;
1647
1666 bool addStickerToSet(std::int64_t userId,
1667 const std::string& name,
1668 const std::string& emojis,
1669 MaskPosition::Ptr maskPosition = nullptr,
1670 boost::variant<InputFile::Ptr, std::string> pngSticker = "",
1671 InputFile::Ptr tgsSticker = nullptr,
1672 InputFile::Ptr webmSticker = nullptr) const;
1673
1682 bool setStickerPositionInSet(const std::string& sticker,
1683 std::int32_t position) const;
1684
1692 bool deleteStickerFromSet(const std::string& sticker) const;
1693
1706 bool setStickerSetThumb(const std::string& name,
1707 std::int64_t userId,
1708 boost::variant<InputFile::Ptr, std::string> thumb = "") const;
1709
1725 bool answerInlineQuery(const std::string& inlineQueryId,
1726 const std::vector<InlineQueryResult::Ptr>& results,
1727 std::int32_t cacheTime = 300,
1728 bool isPersonal = false,
1729 const std::string& nextOffset = "",
1730 const std::string& switchPmText = "",
1731 const std::string& switchPmParameter = "") const;
1732
1741 SentWebAppMessage::Ptr answerWebAppQuery(const std::string& webAppQueryId,
1742 InlineQueryResult::Ptr result) const;
1743
1778 Message::Ptr sendInvoice(boost::variant<std::int64_t, std::string> chatId,
1779 const std::string& title,
1780 const std::string& description,
1781 const std::string& payload,
1782 const std::string& providerToken,
1783 const std::string& currency,
1784 const std::vector<LabeledPrice::Ptr>& prices,
1785 const std::string& providerData = "",
1786 const std::string& photoUrl = "",
1787 std::int32_t photoSize = 0,
1788 std::int32_t photoWidth = 0,
1789 std::int32_t photoHeight = 0,
1790 bool needName = false,
1791 bool needPhoneNumber = false,
1792 bool needEmail = false,
1793 bool needShippingAddress = false,
1794 bool sendPhoneNumberToProvider = false,
1795 bool sendEmailToProvider = false,
1796 bool isFlexible = false,
1797 std::int32_t replyToMessageId = 0,
1798 GenericReply::Ptr replyMarkup = nullptr,
1799 bool disableNotification = false,
1800 bool allowSendingWithoutReply = false,
1801 std::int32_t maxTipAmount = 0,
1802 const std::vector<std::int32_t>& suggestedTipAmounts = std::vector<std::int32_t>(),
1803 const std::string& startParameter = "",
1804 bool protectContent = false,
1805 std::int32_t messageThreadId = 0) const;
1806
1833 std::string createInvoiceLink(const std::string& title,
1834 const std::string& description,
1835 const std::string& payload,
1836 const std::string& providerToken,
1837 const std::string& currency,
1838 const std::vector<LabeledPrice::Ptr>& prices,
1839 std::int32_t maxTipAmount = 0,
1840 const std::vector<std::int32_t>& suggestedTipAmounts = std::vector<std::int32_t>(),
1841 const std::string& providerData = "",
1842 const std::string& photoUrl = "",
1843 std::int32_t photoSize = 0,
1844 std::int32_t photoWidth = 0,
1845 std::int32_t photoHeight = 0,
1846 bool needName = false,
1847 bool needPhoneNumber = false,
1848 bool needEmail = false,
1849 bool needShippingAddress = false,
1850 bool sendPhoneNumberToProvider = false,
1851 bool sendEmailToProvider = false,
1852 bool isFlexible = false) const;
1853
1866 bool answerShippingQuery(const std::string& shippingQueryId,
1867 bool ok,
1868 const std::vector<ShippingOption::Ptr>& shippingOptions = std::vector<ShippingOption::Ptr>(),
1869 const std::string& errorMessage = "") const;
1870
1883 bool answerPreCheckoutQuery(const std::string& preCheckoutQueryId,
1884 bool ok,
1885 const std::string& errorMessage = "") const;
1886
1900 bool setPassportDataErrors(std::int64_t userId,
1901 const std::vector<PassportElementError::Ptr>& errors) const;
1902
1917 Message::Ptr sendGame(std::int64_t chatId,
1918 const std::string& gameShortName,
1919 std::int32_t replyToMessageId = 0,
1920 InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>(),
1921 bool disableNotification = false,
1922 bool allowSendingWithoutReply = false,
1923 bool protectContent = false,
1924 std::int32_t messageThreadId = 0) const;
1925
1941 Message::Ptr setGameScore(std::int64_t userId,
1942 std::int32_t score,
1943 bool force = false,
1944 bool disableEditMessage = false,
1945 std::int64_t chatId = 0,
1946 std::int32_t messageId = 0,
1947 const std::string& inlineMessageId = "") const;
1948
1965 std::vector<GameHighScore::Ptr> getGameHighScores(std::int64_t userId,
1966 std::int64_t chatId = 0,
1967 std::int32_t messageId = 0,
1968 const std::string& inlineMessageId = "") const;
1969
1978 std::string downloadFile(const std::string& filePath,
1979 const std::vector<HttpReqArg>& args = std::vector<HttpReqArg>()) const;
1980
1988 bool blockedByUser(std::int64_t chatId) const;
1989
1991
1992protected:
1993 boost::property_tree::ptree sendRequest(const std::string& method, const std::vector<HttpReqArg>& args = std::vector<HttpReqArg>()) const;
1994
1995 const std::string _token;
1996 const TgTypeParser _tgTypeParser;
1997 const std::string _url;
1998};
1999}
2000
2001#endif //TGBOT_API_H
This class executes telegram api methods. Telegram docs: https://core.telegram.org/bots/api#available...
Definition Api.h:48
std::string exportChatInviteLink(boost::variant< std::int64_t, std::string > chatId) const
Use this method to generate a new primary invite link for a chat; any previously generated primary li...
bool unbanChatSenderChat(boost::variant< std::int64_t, std::string > chatId, std::int64_t senderChatId) const
Use this method to unban a previously banned channel chat in a supergroup or channel.
Message::Ptr sendLocation(boost::variant< std::int64_t, std::string > chatId, float latitude, float longitude, std::int32_t livePeriod=0, std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, bool disableNotification=false, float horizontalAccuracy=0, std::int32_t heading=0, std::int32_t proximityAlertRadius=0, bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send point on the map.
bool promoteChatMember(boost::variant< std::int64_t, std::string > chatId, std::int64_t userId, bool canChangeInfo=false, bool canPostMessages=false, bool canEditMessages=false, bool canDeleteMessages=false, bool canInviteUsers=false, bool canPinMessages=false, bool canPromoteMembers=false, bool isAnonymous=false, bool canManageChat=false, bool canManageVideoChats=false, bool canRestrictMembers=false, bool canManageTopics=false) const
Use this method to promote or demote a user in a supergroup or a channel.
const TgTypeParser _tgTypeParser
Definition Api.h:1996
bool deleteMyCommands(BotCommandScope::Ptr scope=nullptr, const std::string &languageCode="") const
Use this method to delete the list of the bot's commands for the given scope and user language.
bool deleteWebhook(bool dropPendingUpdates=false) const
Use this method to remove webhook integration if you decide to switch back to Api::getUpdates.
bool setChatPhoto(boost::variant< std::int64_t, std::string > chatId, InputFile::Ptr photo) const
Use this method to set a new profile photo for the chat.
bool setStickerPositionInSet(const std::string &sticker, std::int32_t position) const
Use this method to move a sticker in a set created by the bot to a specific position.
bool declineChatJoinRequest(boost::variant< std::int64_t, std::string > chatId, std::int64_t userId) const
Use this method to decline a chat join request.
MessageId::Ptr copyMessage(boost::variant< std::int64_t, std::string > chatId, boost::variant< std::int64_t, std::string > fromChatId, std::int32_t messageId, const std::string &caption="", const std::string &parseMode="", const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >(), bool disableNotification=false, std::int32_t replyToMessageId=0, bool allowSendingWithoutReply=false, GenericReply::Ptr replyMarkup=std::make_shared< GenericReply >(), bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to copy messages of any kind.
bool sendChatAction(std::int64_t chatId, const std::string &action, std::int32_t messageThreadId=0) const
Use this method when you need to tell the user that something is happening on the bot's side....
bool closeGeneralForumTopic(boost::variant< std::int64_t, std::string > chatId) const
Use this method to close an open 'General' topic in a forum supergroup chat.
bool unhideGeneralForumTopic(boost::variant< std::int64_t, std::string > chatId) const
Use this method to unhide the 'General' topic in a forum supergroup chat.
bool answerShippingQuery(const std::string &shippingQueryId, bool ok, const std::vector< ShippingOption::Ptr > &shippingOptions=std::vector< ShippingOption::Ptr >(), const std::string &errorMessage="") const
Use this method to reply to shipping queries.
StickerSet::Ptr getStickerSet(const std::string &name) const
Use this method to get a sticker set.
bool approveChatJoinRequest(boost::variant< std::int64_t, std::string > chatId, std::int64_t userId) const
Use this method to approve a chat join request.
Message::Ptr sendVideo(boost::variant< std::int64_t, std::string > chatId, boost::variant< InputFile::Ptr, std::string > video, bool supportsStreaming=false, std::int32_t duration=0, std::int32_t width=0, std::int32_t height=0, boost::variant< InputFile::Ptr, std::string > thumb="", const std::string &caption="", std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >(), bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0, bool hasSpoiler=false) const
Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent...
Message::Ptr editMessageReplyMarkup(boost::variant< std::int64_t, std::string > chatId=0, std::int32_t messageId=0, const std::string &inlineMessageId="", GenericReply::Ptr replyMarkup=nullptr) const
Use this method to edit only the reply markup of messages.
std::vector< Message::Ptr > sendMediaGroup(boost::variant< std::int64_t, std::string > chatId, const std::vector< InputMedia::Ptr > &media, bool disableNotification=false, std::int32_t replyToMessageId=0, bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send a group of photos, videos, documents or audios as an album.
std::vector< ChatMember::Ptr > getChatAdministrators(boost::variant< std::int64_t, std::string > chatId) const
Use this method to get a list of administrators in a chat, which aren't bots.
ChatInviteLink::Ptr revokeChatInviteLink(boost::variant< std::int64_t, std::string > chatId, const std::string &inviteLink) const
Use this method to revoke an invite link created by the bot.
Message::Ptr stopMessageLiveLocation(boost::variant< std::int64_t, std::string > chatId="", std::int32_t messageId=0, const std::string &inlineMessageId="", InlineKeyboardMarkup::Ptr replyMarkup=std::make_shared< InlineKeyboardMarkup >()) const
Use this method to stop updating a live location message before livePeriod expires.
bool setWebhook(const std::string &url, InputFile::Ptr certificate=nullptr, std::int32_t maxConnections=40, const StringArrayPtr &allowedUpdates=nullptr, const std::string &ipAddress="", bool dropPendingUpdates=false, const std::string &secretToken="") const
Use this method to specify a URL and receive incoming updates via an outgoing webhook.
Message::Ptr sendVideoNote(boost::variant< std::int64_t, std::string > chatId, boost::variant< InputFile::Ptr, std::string > videoNote, std::int64_t replyToMessageId=0, bool disableNotification=false, std::int32_t duration=0, std::int32_t length=0, boost::variant< InputFile::Ptr, std::string > thumb="", GenericReply::Ptr replyMarkup=nullptr, bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send video messages.
std::vector< GameHighScore::Ptr > getGameHighScores(std::int64_t userId, std::int64_t chatId=0, std::int32_t messageId=0, const std::string &inlineMessageId="") const
Use this method to get data for high score tables.
Message::Ptr editMessageMedia(InputMedia::Ptr media, boost::variant< std::int64_t, std::string > chatId=0, std::int32_t messageId=0, const std::string &inlineMessageId="", GenericReply::Ptr replyMarkup=nullptr) const
Use this method to edit animation, audio, document, photo, or video messages.
WebhookInfo::Ptr getWebhookInfo() const
Use this method to get current webhook status.
const std::string _url
Definition Api.h:1997
Chat::Ptr getChat(boost::variant< std::int64_t, std::string > chatId) const
Use this method to get up to date information about the chat (current name of the user for one-on-one...
bool setMyDefaultAdministratorRights(ChatAdministratorRights::Ptr rights=nullptr, bool forChannels=false) const
Use this method to change the default administrator rights requested by the bot when it's added as an...
Message::Ptr sendDocument(boost::variant< std::int64_t, std::string > chatId, boost::variant< InputFile::Ptr, std::string > document, boost::variant< InputFile::Ptr, std::string > thumb="", const std::string &caption="", std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >(), bool disableContentTypeDetection=false, bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send general files.
bool restrictChatMember(boost::variant< std::int64_t, std::string > chatId, std::int64_t userId, ChatPermissions::Ptr permissions, std::int64_t untilDate=0, bool useIndependentChatPermissions=false) const
Use this method to restrict a user in a supergroup.
bool editGeneralForumTopic(boost::variant< std::int64_t, std::string > chatId, std::string name) const
Use this method to edit the name of the 'General' topic in a forum supergroup chat.
const HttpClient & _httpClient
Definition Api.h:1990
std::vector< Sticker::Ptr > getForumTopicIconStickers() const
Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user.
MenuButton::Ptr getChatMenuButton(std::int64_t chatId=0) const
Use this method to get the current value of the bot's menu button in a private chat,...
User::Ptr getMe() const
A simple method for testing your bot's authentication token.
Message::Ptr sendVenue(boost::variant< std::int64_t, std::string > chatId, float latitude, float longitude, const std::string &title, const std::string &address, const std::string &foursquareId="", const std::string &foursquareType="", bool disableNotification=false, std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, const std::string &googlePlaceId="", const std::string &googlePlaceType="", bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send information about a venue.
bool setChatStickerSet(boost::variant< std::int64_t, std::string > chatId, const std::string &stickerSetName) const
Use this method to set a new group sticker set for a supergroup.
Message::Ptr sendAnimation(boost::variant< std::int64_t, std::string > chatId, boost::variant< InputFile::Ptr, std::string > animation, std::int32_t duration=0, std::int32_t width=0, std::int32_t height=0, boost::variant< InputFile::Ptr, std::string > thumb="", const std::string &caption="", std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >(), bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0, bool hasSpoiler=false) const
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
Message::Ptr sendAudio(boost::variant< std::int64_t, std::string > chatId, boost::variant< InputFile::Ptr, std::string > audio, const std::string &caption="", std::int32_t duration=0, const std::string &performer="", const std::string &title="", boost::variant< InputFile::Ptr, std::string > thumb="", std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >(), bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send audio files, if you want Telegram clients to display them in the music player...
bool deleteForumTopic(boost::variant< std::int64_t, std::string > chatId, std::int32_t messageThreadId) const
Use this method to delete a forum topic along with all its messages in a forum supergroup chat.
Message::Ptr sendPhoto(boost::variant< std::int64_t, std::string > chatId, boost::variant< InputFile::Ptr, std::string > photo, const std::string &caption="", std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >(), bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0, bool hasSpoiler=false) const
Use this method to send photos.
std::vector< BotCommand::Ptr > getMyCommands(BotCommandScope::Ptr scope=nullptr, const std::string &languageCode="") const
Use this method to get the current list of the bot's commands for the given scope and user language.
bool setStickerSetThumb(const std::string &name, std::int64_t userId, boost::variant< InputFile::Ptr, std::string > thumb="") const
Use this method to set the thumbnail of a sticker set.
bool editForumTopic(boost::variant< std::int64_t, std::string > chatId, std::int32_t messageThreadId, const std::string &name="", boost::variant< std::int8_t, std::string > iconCustomEmojiId=0) const
Use this method to edit name and icon of a topic in a forum supergroup chat.
Message::Ptr editMessageText(const std::string &text, boost::variant< std::int64_t, std::string > chatId=0, std::int32_t messageId=0, const std::string &inlineMessageId="", const std::string &parseMode="", bool disableWebPagePreview=false, GenericReply::Ptr replyMarkup=nullptr, const std::vector< MessageEntity::Ptr > &entities=std::vector< MessageEntity::Ptr >()) const
Use this method to edit text and game messages.
std::vector< Update::Ptr > getUpdates(std::int32_t offset=0, std::int32_t limit=100, std::int32_t timeout=0, const StringArrayPtr &allowedUpdates=nullptr) const
Use this method to receive incoming updates using long polling (https://en.wikipedia....
Message::Ptr sendGame(std::int64_t chatId, const std::string &gameShortName, std::int32_t replyToMessageId=0, InlineKeyboardMarkup::Ptr replyMarkup=std::make_shared< InlineKeyboardMarkup >(), bool disableNotification=false, bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send a game.
SentWebAppMessage::Ptr answerWebAppQuery(const std::string &webAppQueryId, InlineQueryResult::Ptr result) const
Use this method to set the result of an interaction with a Web App and send a corresponding message o...
bool addStickerToSet(std::int64_t userId, const std::string &name, const std::string &emojis, MaskPosition::Ptr maskPosition=nullptr, boost::variant< InputFile::Ptr, std::string > pngSticker="", InputFile::Ptr tgsSticker=nullptr, InputFile::Ptr webmSticker=nullptr) const
Use this method to add a new sticker to a set created by the bot.
bool logOut() const
Use this method to log out from the cloud Bot API server before launching the bot locally.
Message::Ptr sendVoice(boost::variant< std::int64_t, std::string > chatId, boost::variant< InputFile::Ptr, std::string > voice, const std::string &caption="", std::int32_t duration=0, std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >(), bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send audio files, if you want Telegram clients to display the file as a playable v...
ChatMember::Ptr getChatMember(boost::variant< std::int64_t, std::string > chatId, std::int64_t userId) const
Use this method to get information about a member of a chat.
bool answerInlineQuery(const std::string &inlineQueryId, const std::vector< InlineQueryResult::Ptr > &results, std::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.
bool pinChatMessage(boost::variant< std::int64_t, std::string > chatId, std::int32_t messageId, bool disableNotification=false) const
Use this method to add a message to the list of pinned messages in a chat.
bool reopenGeneralForumTopic(boost::variant< std::int64_t, std::string > chatId) const
Use this method to reopen a closed 'General' topic in a forum supergroup chat.
bool setChatDescription(boost::variant< std::int64_t, std::string > chatId, const std::string &description="") const
Use this method to change the description of a group, a supergroup or a channel.
bool unpinChatMessage(boost::variant< std::int64_t, std::string > chatId, std::int32_t messageId=0) const
Use this method to remove a message from the list of pinned messages in a chat.
bool deleteStickerFromSet(const std::string &sticker) const
Use this method to delete a sticker from a set created by the bot.
File::Ptr uploadStickerFile(std::int64_t userId, InputFile::Ptr pngSticker) const
Use this method to upload a .PNG file with a sticker for later use in Api::createNewStickerSet and Ap...
UserProfilePhotos::Ptr getUserProfilePhotos(std::int64_t userId, std::int32_t offset=0, std::int32_t limit=100) const
Use this method to get a list of profile pictures for a user.
bool reopenForumTopic(boost::variant< std::int64_t, std::string > chatId, std::int32_t messageThreadId) const
Use this method to reopen a closed topic in a forum supergroup chat.
bool setMyCommands(const std::vector< BotCommand::Ptr > &commands, BotCommandScope::Ptr scope=nullptr, const std::string &languageCode="") const
Use this method to change the list of the bot's commands.
ChatInviteLink::Ptr createChatInviteLink(boost::variant< std::int64_t, std::string > chatId, std::int32_t expireDate=0, std::int32_t memberLimit=0, const std::string &name="", bool createsJoinRequest=false) const
Use this method to create an additional invite link for a chat.
Message::Ptr sendMessage(boost::variant< std::int64_t, std::string > chatId, const std::string &text, bool disableWebPagePreview=false, std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &entities=std::vector< MessageEntity::Ptr >(), bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send text messages.
std::int32_t getChatMemberCount(boost::variant< std::int64_t, std::string > chatId) const
Use this method to get the number of members in a chat.
bool setPassportDataErrors(std::int64_t userId, const std::vector< PassportElementError::Ptr > &errors) const
Informs a user that some of the Telegram Passport elements they provided contains errors.
ForumTopic::Ptr createForumTopic(boost::variant< std::int64_t, std::string > chatId, const std::string &name, std::int32_t iconColor=0, const std::string &iconCustomEmojiId="") const
Use this method to create a topic in a forum supergroup chat.
bool setChatTitle(boost::variant< std::int64_t, std::string > chatId, const std::string &title) const
Use this method to change the title of a chat.
bool setChatAdministratorCustomTitle(boost::variant< std::int64_t, std::string > chatId, std::int64_t userId, const std::string &customTitle) const
Use this method to set a custom title for an administrator in a supergroup promoted by the bot.
std::string downloadFile(const std::string &filePath, const std::vector< HttpReqArg > &args=std::vector< HttpReqArg >()) const
Download a file from Telegram and save it in memory.
Api(std::string token, const HttpClient &httpClient, const std::string &url)
bool unbanChatMember(boost::variant< std::int64_t, std::string > chatId, std::int64_t userId, bool onlyIfBanned=false) const
Use this method to unban a previously banned user in a supergroup or channel.
Message::Ptr editMessageCaption(boost::variant< std::int64_t, std::string > chatId=0, std::int32_t messageId=0, const std::string &caption="", const std::string &inlineMessageId="", GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >()) const
Use this method to edit captions of messages.
bool setChatPermissions(boost::variant< std::int64_t, std::string > chatId, ChatPermissions::Ptr permissions, bool useIndependentChatPermissions=false) const
Use this method to set default chat permissions for all members.
bool banChatMember(boost::variant< std::int64_t, std::string > chatId, std::int64_t userId, std::int32_t untilDate=0, bool revokeMessages=true) const
Use this method to ban a user in a group, a supergroup or a channel.
ChatInviteLink::Ptr editChatInviteLink(boost::variant< std::int64_t, std::string > chatId, const std::string &inviteLink, std::int32_t expireDate=0, std::int32_t memberLimit=0, const std::string &name="", bool createsJoinRequest=false) const
Use this method to edit a non-primary invite link created by the bot.
bool blockedByUser(std::int64_t chatId) const
Check if user has blocked the bot.
bool closeForumTopic(boost::variant< std::int64_t, std::string > chatId, std::int32_t messageThreadId) const
Use this method to close an open topic in a forum supergroup chat.
bool deleteChatPhoto(boost::variant< std::int64_t, std::string > chatId) const
Use this method to delete a chat photo.
bool answerPreCheckoutQuery(const std::string &preCheckoutQueryId, bool ok, const std::string &errorMessage="") const
Use this method to respond to such pre-checkout queries.
std::vector< Sticker::Ptr > getCustomEmojiStickers(const std::vector< std::string > &customEmojiIds) const
Use this method to get information about custom emoji stickers by their identifiers.
bool unpinAllForumTopicMessages(boost::variant< std::int64_t, std::string > chatId, std::int32_t messageThreadId) const
Use this method to clear the list of pinned messages in a forum topic.
ChatAdministratorRights::Ptr getMyDefaultAdministratorRights(bool forChannels=false) const
Use this method to get the current default administrator rights of the bot.
bool leaveChat(boost::variant< std::int64_t, std::string > chatId) const
Use this method for your bot to leave a group, supergroup or channel.
Message::Ptr editMessageLiveLocation(float latitude, float longitude, boost::variant< std::int64_t, std::string > chatId="", std::int32_t messageId=0, const std::string &inlineMessageId="", InlineKeyboardMarkup::Ptr replyMarkup=std::make_shared< InlineKeyboardMarkup >(), float horizontalAccuracy=0, std::int32_t heading=0, std::int32_t proximityAlertRadius=0) const
Use this method to edit live location messages.
File::Ptr getFile(const std::string &fileId) const
Use this method to get basic information about a file and prepare it for downloading.
Poll::Ptr stopPoll(boost::variant< std::int64_t, std::string > chatId, std::int64_t messageId, InlineKeyboardMarkup::Ptr replyMarkup=std::make_shared< InlineKeyboardMarkup >()) const
Use this method to stop a poll which was sent by the bot.
const std::string _token
Definition Api.h:1995
bool unpinAllChatMessages(boost::variant< std::int64_t, std::string > chatId) const
Use this method to clear the list of pinned messages in a chat.
Message::Ptr setGameScore(std::int64_t userId, std::int32_t score, bool force=false, bool disableEditMessage=false, std::int64_t chatId=0, std::int32_t messageId=0, const std::string &inlineMessageId="") const
Use this method to set the score of the specified user in a game message.
Message::Ptr sendPoll(boost::variant< std::int64_t, std::string > chatId, const std::string &question, const std::vector< std::string > &options, bool disableNotification=false, std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, bool isAnonymous=true, const std::string &type="", bool allowsMultipleAnswers=false, std::int32_t correctOptionId=-1, const std::string &explanation="", const std::string &explanationParseMode="", const std::vector< MessageEntity::Ptr > &explanationEntities=std::vector< MessageEntity::Ptr >(), std::int32_t openPeriod=0, std::int32_t closeDate=0, bool isClosed=false, bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send a native poll.
bool hideGeneralForumTopic(boost::variant< std::int64_t, std::string > chatId) const
Use this method to hide the 'General' topic in a forum supergroup chat.
Message::Ptr sendSticker(boost::variant< std::int64_t, std::string > chatId, boost::variant< InputFile::Ptr, std::string > sticker, std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, bool disableNotification=false, bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
Message::Ptr sendContact(boost::variant< std::int64_t, std::string > chatId, const std::string &phoneNumber, const std::string &firstName, const std::string &lastName="", const std::string &vcard="", bool disableNotification=false, std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send phone contacts.
bool deleteMessage(boost::variant< std::int64_t, std::string > chatId, std::int32_t messageId) const
Use this method to delete a message, including service messages, with the following limitations:
bool answerCallbackQuery(const std::string &callbackQueryId, const std::string &text="", bool showAlert=false, const std::string &url="", std::int32_t cacheTime=0) const
Use this method to send answers to callback queries sent from inline keyboards.
boost::property_tree::ptree sendRequest(const std::string &method, const std::vector< HttpReqArg > &args=std::vector< HttpReqArg >()) const
bool setChatMenuButton(std::int64_t chatId=0, MenuButton::Ptr menuButton=nullptr) const
Use this method to change the bot's menu button in a private chat, or the default menu button.
bool deleteChatStickerSet(boost::variant< std::int64_t, std::string > chatId) const
Use this method to delete a group sticker set from a supergroup.
bool close() const
Use this method to close the bot instance before moving it from one local server to another.
Message::Ptr sendInvoice(boost::variant< std::int64_t, std::string > chatId, const std::string &title, const std::string &description, const std::string &payload, const std::string &providerToken, const std::string &currency, const std::vector< LabeledPrice::Ptr > &prices, const std::string &providerData="", const std::string &photoUrl="", std::int32_t photoSize=0, std::int32_t photoWidth=0, std::int32_t photoHeight=0, bool needName=false, bool needPhoneNumber=false, bool needEmail=false, bool needShippingAddress=false, bool sendPhoneNumberToProvider=false, bool sendEmailToProvider=false, bool isFlexible=false, std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, bool disableNotification=false, bool allowSendingWithoutReply=false, std::int32_t maxTipAmount=0, const std::vector< std::int32_t > &suggestedTipAmounts=std::vector< std::int32_t >(), const std::string &startParameter="", bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send invoices.
Message::Ptr sendDice(boost::variant< std::int64_t, std::string > chatId, bool disableNotification=false, std::int32_t replyToMessageId=0, GenericReply::Ptr replyMarkup=nullptr, const std::string &emoji="", bool allowSendingWithoutReply=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to send an animated emoji that will display a random value.
bool banChatSenderChat(boost::variant< std::int64_t, std::string > chatId, std::int64_t senderChatId) const
Use this method to ban a channel chat in a supergroup or a channel.
bool createNewStickerSet(std::int64_t userId, const std::string &name, const std::string &title, const std::string &emojis, MaskPosition::Ptr maskPosition=nullptr, boost::variant< InputFile::Ptr, std::string > pngSticker="", InputFile::Ptr tgsSticker=nullptr, InputFile::Ptr webmSticker=nullptr, const std::string &stickerType="") const
Use this method to create a new sticker set owned by a user.
std::string createInvoiceLink(const std::string &title, const std::string &description, const std::string &payload, const std::string &providerToken, const std::string &currency, const std::vector< LabeledPrice::Ptr > &prices, std::int32_t maxTipAmount=0, const std::vector< std::int32_t > &suggestedTipAmounts=std::vector< std::int32_t >(), const std::string &providerData="", const std::string &photoUrl="", std::int32_t photoSize=0, std::int32_t photoWidth=0, std::int32_t photoHeight=0, bool needName=false, bool needPhoneNumber=false, bool needEmail=false, bool needShippingAddress=false, bool sendPhoneNumberToProvider=false, bool sendEmailToProvider=false, bool isFlexible=false) const
Use this method to create a link for an invoice.
Message::Ptr forwardMessage(boost::variant< std::int64_t, std::string > chatId, boost::variant< std::int64_t, std::string > fromChatId, std::int32_t messageId, bool disableNotification=false, bool protectContent=false, std::int32_t messageThreadId=0) const
Use this method to forward messages of any kind.
std::shared_ptr< BotCommandScope > Ptr
This object holds other objects specific for this bot instance.
Definition Bot.h:21
std::shared_ptr< ChatAdministratorRights > Ptr
std::shared_ptr< Chat > Ptr
Definition Chat.h:25
std::shared_ptr< ChatMember > Ptr
Definition ChatMember.h:21
std::shared_ptr< ChatPermissions > Ptr
std::shared_ptr< File > Ptr
Definition File.h:23
std::shared_ptr< ForumTopic > Ptr
Definition ForumTopic.h:17
std::shared_ptr< GenericReply > Ptr
This class makes http requests.
Definition HttpClient.h:18
std::shared_ptr< InlineKeyboardMarkup > Ptr
std::shared_ptr< InlineQueryResult > Ptr
std::shared_ptr< InputFile > Ptr
Definition InputFile.h:19
std::shared_ptr< InputMedia > Ptr
Definition InputMedia.h:21
std::shared_ptr< MaskPosition > Ptr
std::shared_ptr< MenuButton > Ptr
Definition MenuButton.h:21
std::shared_ptr< Message > Ptr
Definition Message.h:57
std::shared_ptr< MessageId > Ptr
Definition MessageId.h:16
std::shared_ptr< Poll > Ptr
Definition Poll.h:22
std::shared_ptr< SentWebAppMessage > Ptr
std::shared_ptr< StickerSet > Ptr
Definition StickerSet.h:20
std::shared_ptr< User > Ptr
Definition User.h:18
std::shared_ptr< UserProfilePhotos > Ptr
std::shared_ptr< WebhookInfo > Ptr
Definition WebhookInfo.h:18
Definition Api.h:39