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"
20#include "tgbot/types/Sticker.h"
22#include "tgbot/types/File.h"
30
31#include <boost/property_tree/ptree.hpp>
32#include <boost/variant.hpp>
33
34#include <cstdint>
35#include <memory>
36#include <string>
37#include <utility>
38#include <vector>
39
40namespace TgBot {
41
42class Bot;
43
49class TGBOT_API Api {
50
51typedef std::shared_ptr<std::vector<std::string>> StringArrayPtr;
52
53friend class Bot;
54
55public:
56 Api(std::string token, const HttpClient& httpClient, const std::string& url);
57
72 std::vector<Update::Ptr> getUpdates(std::int32_t offset = 0,
73 std::int32_t limit = 100,
74 std::int32_t timeout = 0,
75 const StringArrayPtr& allowedUpdates = nullptr) const;
76
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
178 Message::Ptr sendMessage(boost::variant<std::int64_t, std::string> chatId,
179 const std::string& text,
180 LinkPreviewOptions::Ptr linkPreviewOptions = nullptr,
181 ReplyParameters::Ptr replyParameters = nullptr,
182 GenericReply::Ptr replyMarkup = nullptr,
183 const std::string& parseMode = "",
184 bool disableNotification = false,
185 const std::vector<MessageEntity::Ptr>& entities = std::vector<MessageEntity::Ptr>(),
186 std::int32_t messageThreadId = 0,
187 bool protectContent = false,
188 const std::string& businessConnectionId = "") const;
189
204 Message::Ptr forwardMessage(boost::variant<std::int64_t, std::string> chatId,
205 boost::variant<std::int64_t, std::string> fromChatId,
206 std::int32_t messageId,
207 bool disableNotification = false,
208 bool protectContent = false,
209 std::int32_t messageThreadId = 0) const;
210
227 std::vector<MessageId::Ptr> forwardMessages(boost::variant<std::int64_t, std::string> chatId,
228 boost::variant<std::int64_t, std::string> fromChatId,
229 const std::vector<std::int32_t>& messageIds,
230 std::int32_t messageThreadId = 0,
231 bool disableNotification = false,
232 bool protectContent = false) const;
233
255 MessageId::Ptr copyMessage(boost::variant<std::int64_t, std::string> chatId,
256 boost::variant<std::int64_t, std::string> fromChatId,
257 std::int32_t messageId,
258 const std::string& caption = "",
259 const std::string& parseMode = "",
260 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
261 bool disableNotification = false,
262 ReplyParameters::Ptr replyParameters = nullptr,
263 GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
264 bool protectContent = false,
265 std::int32_t messageThreadId = 0) const;
266
286 std::vector<MessageId::Ptr> copyMessages(boost::variant<std::int64_t, std::string> chatId,
287 boost::variant<std::int64_t, std::string> fromChatId,
288 const std::vector<std::int32_t>& messageIds,
289 std::int32_t messageThreadId = 0,
290 bool disableNotification = false,
291 bool protectContent = false,
292 bool removeCaption = false) const;
293
312 Message::Ptr sendPhoto(boost::variant<std::int64_t, std::string> chatId,
313 boost::variant<InputFile::Ptr, std::string> photo,
314 const std::string& caption = "",
315 ReplyParameters::Ptr replyParameters = nullptr,
316 GenericReply::Ptr replyMarkup = nullptr,
317 const std::string& parseMode = "",
318 bool disableNotification = false,
319 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
320 std::int32_t messageThreadId = 0,
321 bool protectContent = false,
322 bool hasSpoiler = false,
323 const std::string& businessConnectionId = "") const;
324
351 Message::Ptr sendAudio(boost::variant<std::int64_t, std::string> chatId,
352 boost::variant<InputFile::Ptr, std::string> audio,
353 const std::string& caption = "",
354 std::int32_t duration = 0,
355 const std::string& performer = "",
356 const std::string& title = "",
357 boost::variant<InputFile::Ptr, std::string> thumbnail = "",
358 ReplyParameters::Ptr replyParameters = nullptr,
359 GenericReply::Ptr replyMarkup = nullptr,
360 const std::string& parseMode = "",
361 bool disableNotification = false,
362 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
363 std::int32_t messageThreadId = 0,
364 bool protectContent = false,
365 const std::string& businessConnectionId = "") const;
366
388 Message::Ptr sendDocument(boost::variant<std::int64_t, std::string> chatId,
389 boost::variant<InputFile::Ptr, std::string> document,
390 boost::variant<InputFile::Ptr, std::string> thumbnail = "",
391 const std::string& caption = "",
392 ReplyParameters::Ptr replyParameters = nullptr,
393 GenericReply::Ptr replyMarkup = nullptr,
394 const std::string& parseMode = "",
395 bool disableNotification = false,
396 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
397 bool disableContentTypeDetection = false,
398 std::int32_t messageThreadId = 0,
399 bool protectContent = false,
400 const std::string& businessConnectionId = "") const;
401
427 Message::Ptr sendVideo(boost::variant<std::int64_t, std::string> chatId,
428 boost::variant<InputFile::Ptr, std::string> video,
429 bool supportsStreaming = false,
430 std::int32_t duration = 0,
431 std::int32_t width = 0,
432 std::int32_t height = 0,
433 boost::variant<InputFile::Ptr, std::string> thumbnail = "",
434 const std::string& caption = "",
435 ReplyParameters::Ptr replyParameters = nullptr,
436 GenericReply::Ptr replyMarkup = nullptr,
437 const std::string& parseMode = "",
438 bool disableNotification = false,
439 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
440 std::int32_t messageThreadId = 0,
441 bool protectContent = false,
442 bool hasSpoiler = false,
443 const std::string& businessConnectionId = "") const;
444
469 Message::Ptr sendAnimation(boost::variant<std::int64_t, std::string> chatId,
470 boost::variant<InputFile::Ptr, std::string> animation,
471 std::int32_t duration = 0,
472 std::int32_t width = 0,
473 std::int32_t height = 0,
474 boost::variant<InputFile::Ptr, std::string> thumbnail = "",
475 const std::string& caption = "",
476 ReplyParameters::Ptr replyParameters = nullptr,
477 GenericReply::Ptr replyMarkup = nullptr,
478 const std::string& parseMode = "",
479 bool disableNotification = false,
480 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
481 std::int32_t messageThreadId = 0,
482 bool protectContent = false,
483 bool hasSpoiler = false,
484 const std::string& businessConnectionId = "") const;
485
507 Message::Ptr sendVoice(boost::variant<std::int64_t, std::string> chatId,
508 boost::variant<InputFile::Ptr, std::string> voice,
509 const std::string& caption = "",
510 std::int32_t duration = 0,
511 ReplyParameters::Ptr replyParameters = nullptr,
512 GenericReply::Ptr replyMarkup = nullptr,
513 const std::string& parseMode = "",
514 bool disableNotification = false,
515 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
516 std::int32_t messageThreadId = 0,
517 bool protectContent = false,
518 const std::string& businessConnectionId = "") const;
519
539 Message::Ptr sendVideoNote(boost::variant<std::int64_t, std::string> chatId,
540 boost::variant<InputFile::Ptr, std::string> videoNote,
541 ReplyParameters::Ptr replyParameters = nullptr,
542 bool disableNotification = false,
543 std::int32_t duration = 0,
544 std::int32_t length = 0,
545 boost::variant<InputFile::Ptr, std::string> thumbnail = "",
546 GenericReply::Ptr replyMarkup = nullptr,
547 std::int32_t messageThreadId = 0,
548 bool protectContent = false,
549 const std::string& businessConnectionId = "") const;
550
566 std::vector<Message::Ptr> sendMediaGroup(boost::variant<std::int64_t, std::string> chatId,
567 const std::vector<InputMedia::Ptr>& media,
568 bool disableNotification = false,
569 ReplyParameters::Ptr replyParameters = nullptr,
570 std::int32_t messageThreadId = 0,
571 bool protectContent = false,
572 const std::string& businessConnectionId = "") const;
573
593 Message::Ptr sendLocation(boost::variant<std::int64_t, std::string> chatId,
594 float latitude,
595 float longitude,
596 std::int32_t livePeriod = 0,
597 ReplyParameters::Ptr replyParameters = nullptr,
598 GenericReply::Ptr replyMarkup = nullptr,
599 bool disableNotification = false,
600 float horizontalAccuracy = 0,
601 std::int32_t heading = 0,
602 std::int32_t proximityAlertRadius = 0,
603 std::int32_t messageThreadId = 0,
604 bool protectContent = false,
605 const std::string& businessConnectionId = "") const;
606
625 float longitude,
626 boost::variant<std::int64_t, std::string> chatId = "",
627 std::int32_t messageId = 0,
628 const std::string& inlineMessageId = "",
629 InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>(),
630 float horizontalAccuracy = 0,
631 std::int32_t heading = 0,
632 std::int32_t proximityAlertRadius = 0) const;
633
644 Message::Ptr stopMessageLiveLocation(boost::variant<std::int64_t, std::string> chatId = "",
645 std::int32_t messageId = 0,
646 const std::string& inlineMessageId = "",
647 InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>()) const;
648
670 Message::Ptr sendVenue(boost::variant<std::int64_t, std::string> chatId,
671 float latitude,
672 float longitude,
673 const std::string& title,
674 const std::string& address,
675 const std::string& foursquareId = "",
676 const std::string& foursquareType = "",
677 bool disableNotification = false,
678 ReplyParameters::Ptr replyParameters = nullptr,
679 GenericReply::Ptr replyMarkup = nullptr,
680 const std::string& googlePlaceId = "",
681 const std::string& googlePlaceType = "",
682 std::int32_t messageThreadId = 0,
683 bool protectContent = false,
684 const std::string& businessConnectionId = "") const;
685
703 Message::Ptr sendContact(boost::variant<std::int64_t, std::string> chatId,
704 const std::string& phoneNumber,
705 const std::string& firstName,
706 const std::string& lastName = "",
707 const std::string& vcard = "",
708 bool disableNotification = false,
709 ReplyParameters::Ptr replyParameters = nullptr,
710 GenericReply::Ptr replyMarkup = nullptr,
711 std::int32_t messageThreadId = 0,
712 bool protectContent = false,
713 const std::string& businessConnectionId = "") const;
714
740 Message::Ptr sendPoll(boost::variant<std::int64_t, std::string> chatId,
741 const std::string& question,
742 const std::vector<std::string>& options,
743 bool disableNotification = false,
744 ReplyParameters::Ptr replyParameters = nullptr,
745 GenericReply::Ptr replyMarkup = nullptr,
746 bool isAnonymous = true,
747 const std::string& type = "",
748 bool allowsMultipleAnswers = false,
749 std::int32_t correctOptionId = -1,
750 const std::string& explanation = "",
751 const std::string& explanationParseMode = "",
752 const std::vector<MessageEntity::Ptr>& explanationEntities = std::vector<MessageEntity::Ptr>(),
753 std::int32_t openPeriod = 0,
754 std::int32_t closeDate = 0,
755 bool isClosed = false,
756 std::int32_t messageThreadId = 0,
757 bool protectContent = false,
758 const std::string& businessConnectionId = "") const;
759
774 Message::Ptr sendDice(boost::variant<std::int64_t, std::string> chatId,
775 bool disableNotification = false,
776 ReplyParameters::Ptr replyParameters = nullptr,
777 GenericReply::Ptr replyMarkup = nullptr,
778 const std::string& emoji = "",
779 std::int32_t messageThreadId = 0,
780 bool protectContent = false,
781 const std::string& businessConnectionId = "") const;
782
796 bool setMessageReaction(boost::variant<std::int64_t, std::string> chatId,
797 std::int32_t messageId = 0,
798 const std::vector<ReactionType::Ptr>& reaction = std::vector<ReactionType::Ptr>(),
799 bool isBig = false) const;
800
819 bool sendChatAction(std::int64_t chatId,
820 const std::string& action,
821 std::int32_t messageThreadId = 0,
822 const std::string& businessConnectionId = "") const;
823
834 std::int32_t offset = 0,
835 std::int32_t limit = 100) const;
836
852 File::Ptr getFile(const std::string& fileId) const;
853
867 bool banChatMember(boost::variant<std::int64_t, std::string> chatId,
868 std::int64_t userId,
869 std::int32_t untilDate = 0,
870 bool revokeMessages = true) const;
871
887 bool unbanChatMember(boost::variant<std::int64_t, std::string> chatId,
888 std::int64_t userId,
889 bool onlyIfBanned = false) const;
890
905 bool restrictChatMember(boost::variant<std::int64_t, std::string> chatId,
906 std::int64_t userId,
907 ChatPermissions::Ptr permissions,
908 std::uint32_t untilDate = 0,
909 bool useIndependentChatPermissions = false) const;
910
937 bool promoteChatMember(boost::variant<std::int64_t, std::string> chatId,
938 std::int64_t userId,
939 bool canChangeInfo = false,
940 bool canPostMessages = false,
941 bool canEditMessages = false,
942 bool canDeleteMessages = false,
943 bool canInviteUsers = false,
944 bool canPinMessages = false,
945 bool canPromoteMembers = false,
946 bool isAnonymous = false,
947 bool canManageChat = false,
948 bool canManageVideoChats = false,
949 bool canRestrictMembers = false,
950 bool canManageTopics = false,
951 bool canPostStories = false,
952 bool canEditStories = false,
953 bool canDeleteStories = false) const;
954
964 bool setChatAdministratorCustomTitle(boost::variant<std::int64_t, std::string> chatId,
965 std::int64_t userId,
966 const std::string& customTitle) const;
967
979 bool banChatSenderChat(boost::variant<std::int64_t, std::string> chatId,
980 std::int64_t senderChatId) const;
981
992 bool unbanChatSenderChat(boost::variant<std::int64_t, std::string> chatId,
993 std::int64_t senderChatId) const;
994
1006 bool setChatPermissions(boost::variant<std::int64_t, std::string> chatId,
1007 ChatPermissions::Ptr permissions,
1008 bool useIndependentChatPermissions = false) const;
1009
1024 std::string exportChatInviteLink(boost::variant<std::int64_t, std::string> chatId) const;
1025
1040 ChatInviteLink::Ptr createChatInviteLink(boost::variant<std::int64_t, std::string> chatId,
1041 std::int32_t expireDate = 0,
1042 std::int32_t memberLimit = 0,
1043 const std::string& name = "",
1044 bool createsJoinRequest = false) const;
1045
1060 ChatInviteLink::Ptr editChatInviteLink(boost::variant<std::int64_t, std::string> chatId,
1061 const std::string& inviteLink,
1062 std::int32_t expireDate = 0,
1063 std::int32_t memberLimit = 0,
1064 const std::string& name = "",
1065 bool createsJoinRequest = false) const;
1066
1078 ChatInviteLink::Ptr revokeChatInviteLink(boost::variant<std::int64_t, std::string> chatId,
1079 const std::string& inviteLink) const;
1080
1091 bool approveChatJoinRequest(boost::variant<std::int64_t, std::string> chatId,
1092 std::int64_t userId) const;
1093
1104 bool declineChatJoinRequest(boost::variant<std::int64_t, std::string> chatId,
1105 std::int64_t userId) const;
1106
1118 bool setChatPhoto(boost::variant<std::int64_t, std::string> chatId,
1119 InputFile::Ptr photo) const;
1120
1131 bool deleteChatPhoto(boost::variant<std::int64_t, std::string> chatId) const;
1132
1144 bool setChatTitle(boost::variant<std::int64_t, std::string> chatId,
1145 const std::string& title) const;
1146
1157 bool setChatDescription(boost::variant<std::int64_t, std::string> chatId,
1158 const std::string& description = "") const;
1159
1171 bool pinChatMessage(boost::variant<std::int64_t, std::string> chatId,
1172 std::int32_t messageId,
1173 bool disableNotification = false) const;
1174
1185 bool unpinChatMessage(boost::variant<std::int64_t, std::string> chatId,
1186 std::int32_t messageId = 0) const;
1187
1197 bool unpinAllChatMessages(boost::variant<std::int64_t, std::string> chatId) const;
1198
1206 bool leaveChat(boost::variant<std::int64_t, std::string> chatId) const;
1207
1215 Chat::Ptr getChat(boost::variant<std::int64_t, std::string> chatId) const;
1216
1224 std::vector<ChatMember::Ptr> getChatAdministrators(boost::variant<std::int64_t, std::string> chatId) const;
1225
1233 std::int32_t getChatMemberCount(boost::variant<std::int64_t, std::string> chatId) const;
1234
1245 ChatMember::Ptr getChatMember(boost::variant<std::int64_t, std::string> chatId,
1246 std::int64_t userId) const;
1247
1259 bool setChatStickerSet(boost::variant<std::int64_t, std::string> chatId,
1260 const std::string& stickerSetName) const;
1261
1272 bool deleteChatStickerSet(boost::variant<std::int64_t, std::string> chatId) const;
1273
1279 std::vector<Sticker::Ptr> getForumTopicIconStickers() const;
1280
1293 ForumTopic::Ptr createForumTopic(boost::variant<std::int64_t, std::string> chatId,
1294 const std::string& name,
1295 std::int32_t iconColor = 0,
1296 const std::string& iconCustomEmojiId = "") const;
1297
1310 bool editForumTopic(boost::variant<std::int64_t, std::string> chatId,
1311 std::int32_t messageThreadId,
1312 const std::string& name = "",
1313 boost::variant<std::int32_t, std::string> iconCustomEmojiId = 0) const;
1314
1325 bool closeForumTopic(boost::variant<std::int64_t, std::string> chatId,
1326 std::int32_t messageThreadId) const;
1327
1338 bool reopenForumTopic(boost::variant<std::int64_t, std::string> chatId,
1339 std::int32_t messageThreadId) const;
1340
1351 bool deleteForumTopic(boost::variant<std::int64_t, std::string> chatId,
1352 std::int32_t messageThreadId) const;
1353
1364 bool unpinAllForumTopicMessages(boost::variant<std::int64_t, std::string> chatId,
1365 std::int32_t messageThreadId) const;
1366
1377 bool editGeneralForumTopic(boost::variant<std::int64_t, std::string> chatId,
1378 std::string name) const;
1379
1389 bool closeGeneralForumTopic(boost::variant<std::int64_t, std::string> chatId) const;
1390
1401 bool reopenGeneralForumTopic(boost::variant<std::int64_t, std::string> chatId) const;
1402
1413 bool hideGeneralForumTopic(boost::variant<std::int64_t, std::string> chatId) const;
1414
1424 bool unhideGeneralForumTopic(boost::variant<std::int64_t, std::string> chatId) const;
1425
1435 bool unpinAllGeneralForumTopicMessages(boost::variant<std::int64_t, std::string> chatId) const;
1436
1454 bool answerCallbackQuery(const std::string& callbackQueryId,
1455 const std::string& text = "",
1456 bool showAlert = false,
1457 const std::string& url = "",
1458 std::int32_t cacheTime = 0) const;
1459
1470 UserChatBoosts::Ptr getUserChatBoosts(boost::variant<std::int64_t, std::string> chatId,
1471 std::int32_t userId) const;
1472
1480 BusinessConnection::Ptr getBusinessConnection(const std::string& businessConnectionId) const;
1481
1493 bool setMyCommands(const std::vector<BotCommand::Ptr>& commands,
1494 BotCommandScope::Ptr scope = nullptr,
1495 const std::string& languageCode = "") const;
1496
1508 const std::string& languageCode = "") const;
1509
1518 std::vector<BotCommand::Ptr> getMyCommands(BotCommandScope::Ptr scope = nullptr,
1519 const std::string& languageCode = "") const;
1520
1529 bool setMyName(const std::string& name = "",
1530 const std::string& languageCode = "") const;
1531
1539 BotName::Ptr getMyName(const std::string& languageCode = "") const;
1540
1549 bool setMyDescription(const std::string& description = "",
1550 const std::string& languageCode = "") const;
1551
1559 BotDescription::Ptr getMyDescription(const std::string& languageCode = "") const;
1560
1569 bool setMyShortDescription(const std::string& shortDescription = "",
1570 const std::string& languageCode = "") const;
1571
1579 BotShortDescription::Ptr getMyShortDescription(const std::string& languageCode = "") const;
1580
1589 bool setChatMenuButton(std::int64_t chatId = 0,
1590 MenuButton::Ptr menuButton = nullptr) const;
1591
1599 MenuButton::Ptr getChatMenuButton(std::int64_t chatId = 0) const;
1600
1612 bool forChannels = false) const;
1613
1622
1637 Message::Ptr editMessageText(const std::string& text,
1638 boost::variant<std::int64_t, std::string> chatId = 0,
1639 std::int32_t messageId = 0,
1640 const std::string& inlineMessageId = "",
1641 const std::string& parseMode = "",
1642 LinkPreviewOptions::Ptr linkPreviewOptions = nullptr,
1643 InlineKeyboardMarkup::Ptr replyMarkup = nullptr,
1644 const std::vector<MessageEntity::Ptr>& entities = std::vector<MessageEntity::Ptr>()) const;
1645
1659 Message::Ptr editMessageCaption(boost::variant<std::int64_t, std::string> chatId = 0,
1660 std::int32_t messageId = 0,
1661 const std::string& caption = "",
1662 const std::string& inlineMessageId = "",
1663 GenericReply::Ptr replyMarkup = nullptr,
1664 const std::string& parseMode = "",
1665 const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>()) const;
1666
1682 boost::variant<std::int64_t, std::string> chatId = 0,
1683 std::int32_t messageId = 0,
1684 const std::string& inlineMessageId = "",
1685 GenericReply::Ptr replyMarkup = nullptr) const;
1686
1697 Message::Ptr editMessageReplyMarkup(boost::variant<std::int64_t, std::string> chatId = 0,
1698 std::int32_t messageId = 0,
1699 const std::string& inlineMessageId = "",
1700 GenericReply::Ptr replyMarkup = nullptr) const;
1701
1711 Poll::Ptr stopPoll(boost::variant<std::int64_t, std::string> chatId,
1712 std::int64_t messageId,
1713 InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>()) const;
1714
1732 bool deleteMessage(boost::variant<std::int64_t, std::string> chatId,
1733 std::int32_t messageId) const;
1734
1745 bool deleteMessages(boost::variant<std::int64_t, std::string> chatId,
1746 const std::vector<std::int32_t>& messageIds) const;
1747
1763 Message::Ptr sendSticker(boost::variant<std::int64_t, std::string> chatId,
1764 boost::variant<InputFile::Ptr, std::string> sticker,
1765 ReplyParameters::Ptr replyParameters = nullptr,
1766 GenericReply::Ptr replyMarkup = nullptr,
1767 bool disableNotification = false,
1768 std::int32_t messageThreadId = 0,
1769 bool protectContent = false,
1770 const std::string& emoji = "",
1771 const std::string& businessConnectionId = "") const;
1772
1780 StickerSet::Ptr getStickerSet(const std::string& name) const;
1781
1789 std::vector<Sticker::Ptr> getCustomEmojiStickers(const std::vector<std::string>& customEmojiIds) const;
1790
1800 File::Ptr uploadStickerFile(std::int64_t userId,
1801 InputFile::Ptr sticker,
1802 const std::string& stickerFormat) const;
1803
1818 bool createNewStickerSet(std::int64_t userId,
1819 const std::string& name,
1820 const std::string& title,
1821 const std::vector<InputSticker::Ptr>& stickers,
1822 Sticker::Type stickerType = Sticker::Type::Regular,
1823 bool needsRepainting = false) const;
1824
1837 bool addStickerToSet(std::int64_t userId,
1838 const std::string& name,
1839 InputSticker::Ptr sticker) const;
1840
1849 bool setStickerPositionInSet(const std::string& sticker,
1850 std::int32_t position) const;
1851
1859 bool deleteStickerFromSet(const std::string& sticker) const;
1860
1873 bool replaceStickerInSet(std::int64_t userId,
1874 const std::string& name,
1875 const std::string& oldSticker,
1876 InputSticker::Ptr sticker) const;
1877
1888 bool setStickerEmojiList(const std::string& sticker,
1889 const std::vector<std::string>& emojiList) const;
1890
1901 bool setStickerKeywords(const std::string& sticker,
1902 const std::vector<std::string>& keywords = std::vector<std::string>()) const;
1903
1914 bool setStickerMaskPosition(const std::string& sticker,
1915 MaskPosition::Ptr maskPosition = nullptr) const;
1916
1925 bool setStickerSetTitle(const std::string& name,
1926 const std::string& title) const;
1927
1940 bool setStickerSetThumbnail(const std::string& name,
1941 std::int64_t userId,
1942 const std::string& format,
1943 boost::variant<InputFile::Ptr, std::string> thumbnail = "") const;
1944
1953 bool setCustomEmojiStickerSetThumbnail(const std::string& name,
1954 const std::string& customEmojiId = "") const;
1955
1963 bool deleteStickerSet(const std::string& name) const;
1964
1979 bool answerInlineQuery(const std::string& inlineQueryId,
1980 const std::vector<InlineQueryResult::Ptr>& results,
1981 std::int32_t cacheTime = 300,
1982 bool isPersonal = false,
1983 const std::string& nextOffset = "",
1984 InlineQueryResultsButton::Ptr button = nullptr) const;
1985
1994 SentWebAppMessage::Ptr answerWebAppQuery(const std::string& webAppQueryId,
1995 InlineQueryResult::Ptr result) const;
1996
2030 Message::Ptr sendInvoice(boost::variant<std::int64_t, std::string> chatId,
2031 const std::string& title,
2032 const std::string& description,
2033 const std::string& payload,
2034 const std::string& providerToken,
2035 const std::string& currency,
2036 const std::vector<LabeledPrice::Ptr>& prices,
2037 const std::string& providerData = "",
2038 const std::string& photoUrl = "",
2039 std::int32_t photoSize = 0,
2040 std::int32_t photoWidth = 0,
2041 std::int32_t photoHeight = 0,
2042 bool needName = false,
2043 bool needPhoneNumber = false,
2044 bool needEmail = false,
2045 bool needShippingAddress = false,
2046 bool sendPhoneNumberToProvider = false,
2047 bool sendEmailToProvider = false,
2048 bool isFlexible = false,
2049 ReplyParameters::Ptr replyParameters = nullptr,
2050 GenericReply::Ptr replyMarkup = nullptr,
2051 bool disableNotification = false,
2052 std::int32_t messageThreadId = 0,
2053 std::int32_t maxTipAmount = 0,
2054 const std::vector<std::int32_t>& suggestedTipAmounts = std::vector<std::int32_t>(),
2055 const std::string& startParameter = "",
2056 bool protectContent = false) const;
2057
2084 std::string createInvoiceLink(const std::string& title,
2085 const std::string& description,
2086 const std::string& payload,
2087 const std::string& providerToken,
2088 const std::string& currency,
2089 const std::vector<LabeledPrice::Ptr>& prices,
2090 std::int32_t maxTipAmount = 0,
2091 const std::vector<std::int32_t>& suggestedTipAmounts = std::vector<std::int32_t>(),
2092 const std::string& providerData = "",
2093 const std::string& photoUrl = "",
2094 std::int32_t photoSize = 0,
2095 std::int32_t photoWidth = 0,
2096 std::int32_t photoHeight = 0,
2097 bool needName = false,
2098 bool needPhoneNumber = false,
2099 bool needEmail = false,
2100 bool needShippingAddress = false,
2101 bool sendPhoneNumberToProvider = false,
2102 bool sendEmailToProvider = false,
2103 bool isFlexible = false) const;
2104
2117 bool answerShippingQuery(const std::string& shippingQueryId,
2118 bool ok,
2119 const std::vector<ShippingOption::Ptr>& shippingOptions = std::vector<ShippingOption::Ptr>(),
2120 const std::string& errorMessage = "") const;
2121
2134 bool answerPreCheckoutQuery(const std::string& preCheckoutQueryId,
2135 bool ok,
2136 const std::string& errorMessage = "") const;
2137
2151 bool setPassportDataErrors(std::int64_t userId,
2152 const std::vector<PassportElementError::Ptr>& errors) const;
2153
2168 Message::Ptr sendGame(std::int64_t chatId,
2169 const std::string& gameShortName,
2170 ReplyParameters::Ptr replyParameters = nullptr,
2171 InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>(),
2172 bool disableNotification = false,
2173 std::int32_t messageThreadId = 0,
2174 bool protectContent = false,
2175 const std::string& businessConnectionId = "") const;
2176
2192 Message::Ptr setGameScore(std::int64_t userId,
2193 std::int32_t score,
2194 bool force = false,
2195 bool disableEditMessage = false,
2196 std::int64_t chatId = 0,
2197 std::int32_t messageId = 0,
2198 const std::string& inlineMessageId = "") const;
2199
2216 std::vector<GameHighScore::Ptr> getGameHighScores(std::int64_t userId,
2217 std::int64_t chatId = 0,
2218 std::int32_t messageId = 0,
2219 const std::string& inlineMessageId = "") const;
2220
2229 std::string downloadFile(const std::string& filePath,
2230 const std::vector<HttpReqArg>& args = std::vector<HttpReqArg>()) const;
2231
2239 bool blockedByUser(std::int64_t chatId) const;
2240
2242
2243protected:
2244 boost::property_tree::ptree sendRequest(const std::string& method, const std::vector<HttpReqArg>& args = std::vector<HttpReqArg>()) const;
2245
2246 const std::string _token;
2247 const TgTypeParser _tgTypeParser;
2248 const std::string _url;
2249};
2250}
2251
2252#endif //TGBOT_API_H
This class executes telegram api methods. Telegram docs: https://core.telegram.org/bots/api#available...
Definition Api.h:49
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.
bool setMyName(const std::string &name="", const std::string &languageCode="") const
Use this method to change the bot's name.
const TgTypeParser _tgTypeParser
Definition Api.h:2247
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.
Message::Ptr sendPhoto(boost::variant< std::int64_t, std::string > chatId, boost::variant< InputFile::Ptr, std::string > photo, const std::string &caption="", ReplyParameters::Ptr replyParameters=nullptr, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >(), std::int32_t messageThreadId=0, bool protectContent=false, bool hasSpoiler=false, const std::string &businessConnectionId="") const
Use this method to send photos.
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.
BotShortDescription::Ptr getMyShortDescription(const std::string &languageCode="") const
Use this method to get the current bot short description for the given user language.
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.
File::Ptr uploadStickerFile(std::int64_t userId, InputFile::Ptr sticker, const std::string &stickerFormat) const
Use this method to upload a file with a sticker for later use in the Api::createNewStickerSet,...
bool declineChatJoinRequest(boost::variant< std::int64_t, std::string > chatId, std::int64_t userId) const
Use this method to decline a chat join request.
bool setStickerSetTitle(const std::string &name, const std::string &title) const
Use this method to set the title of a created sticker set.
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 > thumbnail="", const std::string &caption="", ReplyParameters::Ptr replyParameters=nullptr, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >(), std::int32_t messageThreadId=0, bool protectContent=false, bool hasSpoiler=false, const std::string &businessConnectionId="") const
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
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 sendPoll(boost::variant< std::int64_t, std::string > chatId, const std::string &question, const std::vector< std::string > &options, bool disableNotification=false, ReplyParameters::Ptr replyParameters=nullptr, 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, std::int32_t messageThreadId=0, bool protectContent=false, const std::string &businessConnectionId="") const
Use this method to send a native poll.
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.
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 > thumbnail="", const std::string &caption="", ReplyParameters::Ptr replyParameters=nullptr, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >(), std::int32_t messageThreadId=0, bool protectContent=false, bool hasSpoiler=false, const std::string &businessConnectionId="") const
Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent...
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 > thumbnail="", ReplyParameters::Ptr replyParameters=nullptr, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >(), std::int32_t messageThreadId=0, bool protectContent=false, const std::string &businessConnectionId="") const
Use this method to send audio files, if you want Telegram clients to display them in the music player...
Message::Ptr sendGame(std::int64_t chatId, const std::string &gameShortName, ReplyParameters::Ptr replyParameters=nullptr, InlineKeyboardMarkup::Ptr replyMarkup=std::make_shared< InlineKeyboardMarkup >(), bool disableNotification=false, std::int32_t messageThreadId=0, bool protectContent=false, const std::string &businessConnectionId="") const
Use this method to send a game.
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.
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:2248
Chat::Ptr getChat(boost::variant< std::int64_t, std::string > chatId) const
Use this method to get up to date information about the chat.
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...
bool setStickerMaskPosition(const std::string &sticker, MaskPosition::Ptr maskPosition=nullptr) const
Use this method to change the mask position of a mask sticker.
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:2241
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.
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 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, ReplyParameters::Ptr replyParameters=nullptr, GenericReply::Ptr replyMarkup=nullptr, std::int32_t messageThreadId=0, bool protectContent=false, const std::string &businessConnectionId="") const
Use this method to send phone contacts.
BotDescription::Ptr getMyDescription(const std::string &languageCode="") const
Use this method to get the current bot description for the given user language.
bool setMyShortDescription(const std::string &shortDescription="", const std::string &languageCode="") const
Use this method to change the bot's short description, which is shown on the bot's profile page and i...
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 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, ReplyParameters::Ptr replyParameters=nullptr, GenericReply::Ptr replyMarkup=nullptr, bool disableNotification=false, std::int32_t messageThreadId=0, std::int32_t maxTipAmount=0, const std::vector< std::int32_t > &suggestedTipAmounts=std::vector< std::int32_t >(), const std::string &startParameter="", bool protectContent=false) const
Use this method to send invoices.
Message::Ptr sendSticker(boost::variant< std::int64_t, std::string > chatId, boost::variant< InputFile::Ptr, std::string > sticker, ReplyParameters::Ptr replyParameters=nullptr, GenericReply::Ptr replyMarkup=nullptr, bool disableNotification=false, std::int32_t messageThreadId=0, bool protectContent=false, const std::string &emoji="", const std::string &businessConnectionId="") const
Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
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, ReplyParameters::Ptr replyParameters=nullptr, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >(), std::int32_t messageThreadId=0, bool protectContent=false, const std::string &businessConnectionId="") const
Use this method to send audio files, if you want Telegram clients to display the file as a playable v...
bool replaceStickerInSet(std::int64_t userId, const std::string &name, const std::string &oldSticker, InputSticker::Ptr sticker) const
Use this method to replace an existing sticker in a sticker set with a new one.
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.
Message::Ptr sendLocation(boost::variant< std::int64_t, std::string > chatId, float latitude, float longitude, std::int32_t livePeriod=0, ReplyParameters::Ptr replyParameters=nullptr, GenericReply::Ptr replyMarkup=nullptr, bool disableNotification=false, float horizontalAccuracy=0, std::int32_t heading=0, std::int32_t proximityAlertRadius=0, std::int32_t messageThreadId=0, bool protectContent=false, const std::string &businessConnectionId="") const
Use this method to send point on the map.
std::vector< MessageId::Ptr > copyMessages(boost::variant< std::int64_t, std::string > chatId, boost::variant< std::int64_t, std::string > fromChatId, const std::vector< std::int32_t > &messageIds, std::int32_t messageThreadId=0, bool disableNotification=false, bool protectContent=false, bool removeCaption=false) const
Use this method to copy messages of any kind.
Message::Ptr sendDice(boost::variant< std::int64_t, std::string > chatId, bool disableNotification=false, ReplyParameters::Ptr replyParameters=nullptr, GenericReply::Ptr replyMarkup=nullptr, const std::string &emoji="", std::int32_t messageThreadId=0, bool protectContent=false, const std::string &businessConnectionId="") const
Use this method to send an animated emoji that will display a random value.
bool setStickerEmojiList(const std::string &sticker, const std::vector< std::string > &emojiList) const
Use this method to change the list of emoji assigned to a regular or custom emoji sticker.
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 (wiki).
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 logOut() const
Use this method to log out from the cloud Bot API server before launching the bot locally.
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 sendChatAction(std::int64_t chatId, const std::string &action, std::int32_t messageThreadId=0, const std::string &businessConnectionId="") const
Use this method when you need to tell the user that something is happening on the bot's side.
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 answerInlineQuery(const std::string &inlineQueryId, const std::vector< InlineQueryResult::Ptr > &results, std::int32_t cacheTime=300, bool isPersonal=false, const std::string &nextOffset="", InlineQueryResultsButton::Ptr button=nullptr) const
Use this method to send answers to an inline query.
std::vector< MessageId::Ptr > forwardMessages(boost::variant< std::int64_t, std::string > chatId, boost::variant< std::int64_t, std::string > fromChatId, const std::vector< std::int32_t > &messageIds, std::int32_t messageThreadId=0, bool disableNotification=false, bool protectContent=false) const
Use this method to forward multiple messages of any kind.
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 restrictChatMember(boost::variant< std::int64_t, std::string > chatId, std::int64_t userId, ChatPermissions::Ptr permissions, std::uint32_t untilDate=0, bool useIndependentChatPermissions=false) const
Use this method to restrict a user in a supergroup.
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.
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.
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.
bool deleteMessages(boost::variant< std::int64_t, std::string > chatId, const std::vector< std::int32_t > &messageIds) const
Use this method to delete multiple messages simultaneously.
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.
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, ReplyParameters::Ptr replyParameters=nullptr, GenericReply::Ptr replyMarkup=nullptr, const std::string &googlePlaceId="", const std::string &googlePlaceType="", std::int32_t messageThreadId=0, bool protectContent=false, const std::string &businessConnectionId="") const
Use this method to send information about a venue.
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 setMessageReaction(boost::variant< std::int64_t, std::string > chatId, std::int32_t messageId=0, const std::vector< ReactionType::Ptr > &reaction=std::vector< ReactionType::Ptr >(), bool isBig=false) const
Use this method to change the chosen reactions on a message.
bool setMyDescription(const std::string &description="", const std::string &languageCode="") const
Use this method to change the bot's description, which is shown in the chat with the bot if the 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.
bool addStickerToSet(std::int64_t userId, const std::string &name, InputSticker::Ptr sticker) const
Use this method to add a new sticker to a set created by the bot.
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.
Message::Ptr sendMessage(boost::variant< std::int64_t, std::string > chatId, const std::string &text, LinkPreviewOptions::Ptr linkPreviewOptions=nullptr, ReplyParameters::Ptr replyParameters=nullptr, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &entities=std::vector< MessageEntity::Ptr >(), std::int32_t messageThreadId=0, bool protectContent=false, const std::string &businessConnectionId="") const
Use this method to send text 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.
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, bool canPostStories=false, bool canEditStories=false, bool canDeleteStories=false) const
Use this method to promote or demote a user in a supergroup or a channel.
const std::string _token
Definition Api.h:2246
bool unpinAllChatMessages(boost::variant< std::int64_t, std::string > chatId) const
Use this method to clear the list of pinned messages in a chat.
bool setCustomEmojiStickerSetThumbnail(const std::string &name, const std::string &customEmojiId="") const
Use this method to set the thumbnail of a custom emoji sticker set.
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.
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 sendDocument(boost::variant< std::int64_t, std::string > chatId, boost::variant< InputFile::Ptr, std::string > document, boost::variant< InputFile::Ptr, std::string > thumbnail="", const std::string &caption="", ReplyParameters::Ptr replyParameters=nullptr, GenericReply::Ptr replyMarkup=nullptr, const std::string &parseMode="", bool disableNotification=false, const std::vector< MessageEntity::Ptr > &captionEntities=std::vector< MessageEntity::Ptr >(), bool disableContentTypeDetection=false, std::int32_t messageThreadId=0, bool protectContent=false, const std::string &businessConnectionId="") const
Use this method to send general files.
std::vector< Message::Ptr > sendMediaGroup(boost::variant< std::int64_t, std::string > chatId, const std::vector< InputMedia::Ptr > &media, bool disableNotification=false, ReplyParameters::Ptr replyParameters=nullptr, std::int32_t messageThreadId=0, bool protectContent=false, const std::string &businessConnectionId="") const
Use this method to send a group of photos, videos, documents or audios as an album.
bool setStickerKeywords(const std::string &sticker, const std::vector< std::string > &keywords=std::vector< std::string >()) const
Use this method to change search keywords assigned to a regular or custom emoji sticker.
bool createNewStickerSet(std::int64_t userId, const std::string &name, const std::string &title, const std::vector< InputSticker::Ptr > &stickers, Sticker::Type stickerType=Sticker::Type::Regular, bool needsRepainting=false) const
Use this method to create a new sticker set owned by a user.
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="", LinkPreviewOptions::Ptr linkPreviewOptions=nullptr, InlineKeyboardMarkup::Ptr replyMarkup=nullptr, const std::vector< MessageEntity::Ptr > &entities=std::vector< MessageEntity::Ptr >()) const
Use this method to edit text and game messages.
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:
BusinessConnection::Ptr getBusinessConnection(const std::string &businessConnectionId) const
Use this method to get information about the connection of the bot with a business account.
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.
BotName::Ptr getMyName(const std::string &languageCode="") const
Use this method to get the current bot name for the given user language.
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 setStickerSetThumbnail(const std::string &name, std::int64_t userId, const std::string &format, boost::variant< InputFile::Ptr, std::string > thumbnail="") const
Use this method to set the thumbnail of a regular or mask sticker set.
bool editForumTopic(boost::variant< std::int64_t, std::string > chatId, std::int32_t messageThreadId, const std::string &name="", boost::variant< std::int32_t, std::string > iconCustomEmojiId=0) const
Use this method to edit name and icon of a topic in a forum supergroup chat.
bool close() const
Use this method to close the bot instance before moving it from one local server to another.
bool deleteStickerSet(const std::string &name) const
Use this method to delete a sticker set that was created by the bot.
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.
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, ReplyParameters::Ptr replyParameters=nullptr, 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.
Message::Ptr sendVideoNote(boost::variant< std::int64_t, std::string > chatId, boost::variant< InputFile::Ptr, std::string > videoNote, ReplyParameters::Ptr replyParameters=nullptr, bool disableNotification=false, std::int32_t duration=0, std::int32_t length=0, boost::variant< InputFile::Ptr, std::string > thumbnail="", GenericReply::Ptr replyMarkup=nullptr, std::int32_t messageThreadId=0, bool protectContent=false, const std::string &businessConnectionId="") const
Use this method to send video messages.
UserChatBoosts::Ptr getUserChatBoosts(boost::variant< std::int64_t, std::string > chatId, std::int32_t userId) const
Use this method to get the list of boosts added to a chat 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.
bool unpinAllGeneralForumTopicMessages(boost::variant< std::int64_t, std::string > chatId) const
Use this method to clear the list of pinned messages in a General forum topic.
std::shared_ptr< BotCommandScope > Ptr
std::shared_ptr< BotDescription > Ptr
This object holds other objects specific for this bot instance.
Definition Bot.h:21
std::shared_ptr< BotName > Ptr
Definition BotName.h:16
std::shared_ptr< BotShortDescription > Ptr
std::shared_ptr< BusinessConnection > Ptr
std::shared_ptr< ChatAdministratorRights > Ptr
std::shared_ptr< Chat > Ptr
Definition Chat.h:31
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< InlineQueryResultsButton > Ptr
std::shared_ptr< InputFile > Ptr
Definition InputFile.h:19
std::shared_ptr< InputMedia > Ptr
Definition InputMedia.h:21
std::shared_ptr< InputSticker > Ptr
std::shared_ptr< MaskPosition > Ptr
std::shared_ptr< MenuButton > Ptr
Definition MenuButton.h:21
std::shared_ptr< Message > Ptr
Definition Message.h:68
std::shared_ptr< MessageId > Ptr
Definition MessageId.h:16
std::shared_ptr< Poll > Ptr
Definition Poll.h:22
std::shared_ptr< ReplyParameters > Ptr
std::shared_ptr< SentWebAppMessage > Ptr
Type
Enum of possible types of a sticker.
Definition Sticker.h:27
std::shared_ptr< StickerSet > Ptr
Definition StickerSet.h:21
std::shared_ptr< UserChatBoosts > Ptr
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:40