From 270612dc36df84fe25d7fa5e59ca20647b1e5da9 Mon Sep 17 00:00:00 2001 From: llnulldisk <48621230+llnulldisk@users.noreply.github.com> Date: Sun, 11 Sep 2022 15:13:51 +0200 Subject: Update to API 6.2 --- src/Api.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/Api.cpp') diff --git a/src/Api.cpp b/src/Api.cpp index 8d5ef2d..4107a4e 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -1676,6 +1676,17 @@ StickerSet::Ptr Api::getStickerSet(const string& name) const { return _tgTypeParser.parseJsonAndGetStickerSet(sendRequest("getStickerSet", args)); } +std::vector Api::getCustomEmojiStickers(const std::vector& customEmojiIds) const { + vector args; + args.reserve(1); + + args.emplace_back("custom_emoji_ids", _tgTypeParser.parseArray([] (const std::string& customEmojiId) -> std::string { + return "\"" + StringTools::urlEncode(customEmojiId) + "\""; + }, customEmojiIds)); + + return _tgTypeParser.parseJsonAndGetArray(&TgTypeParser::parseJsonAndGetSticker, sendRequest("getCustomEmojiStickers", args)); +} + File::Ptr Api::uploadStickerFile(std::int64_t userId, const InputFile::Ptr pngSticker) const { vector args; args.reserve(2); @@ -1688,13 +1699,13 @@ bool Api::createNewStickerSet(std::int64_t userId, const std::string& name, const std::string& title, const std::string& emojis, - bool containsMasks, MaskPosition::Ptr maskPosition, boost::variant pngSticker, InputFile::Ptr tgsSticker, - InputFile::Ptr webmSticker) const { + InputFile::Ptr webmSticker, + const std::string& stickerType) const { vector args; - args.reserve(9); + args.reserve(10); args.emplace_back("user_id", userId); args.emplace_back("name", name); @@ -1711,10 +1722,10 @@ bool Api::createNewStickerSet(std::int64_t userId, if (webmSticker != nullptr) { args.emplace_back("webm_sticker", webmSticker->data, true, webmSticker->mimeType, webmSticker->fileName); } - args.emplace_back("emojis", emojis); - if (containsMasks) { - args.emplace_back("contains_mask", containsMasks); + if (!stickerType.empty()) { + args.emplace_back("sticker_type", stickerType); } + args.emplace_back("emojis", emojis); if (maskPosition != nullptr) { args.emplace_back("mask_position", _tgTypeParser.parseMaskPosition(maskPosition)); } -- cgit v1.2.3