diff options
author | JellyBrick <shlee1503@naver.com> | 2021-12-03 18:35:06 +0900 |
---|---|---|
committer | JellyBrick <shlee1503@naver.com> | 2021-12-03 18:35:06 +0900 |
commit | 3553efe53c9df0c685a58c00be71b9bb841b4c70 (patch) | |
tree | 8b1b5c43fdcf923b39ec8c150cc92f33c00b7afd /src | |
parent | 814ac074633125c975fa6979e79c93cc7115a57b (diff) |
migrate(user-id): from 32-bit integer to 64-bit integer
fix #187, fix #186, fix #181
Diffstat (limited to 'src')
-rw-r--r-- | src/Api.cpp | 22 | ||||
-rw-r--r-- | src/TgTypeParser.cpp | 6 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/Api.cpp b/src/Api.cpp index 08b102a..ff39805 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -312,7 +312,7 @@ StickerSet::Ptr Api::getStickerSet(const string& name) const { return _tgTypeParser.parseJsonAndGetStickerSet(sendRequest("getStickerSet", args)); } -File::Ptr Api::uploadStickerFile(std::int32_t userId, const InputFile::Ptr pngSticker) const { +File::Ptr Api::uploadStickerFile(std::int64_t userId, const InputFile::Ptr pngSticker) const { vector<HttpReqArg> args; args.reserve(2); args.emplace_back("user_id", userId); @@ -320,7 +320,7 @@ File::Ptr Api::uploadStickerFile(std::int32_t userId, const InputFile::Ptr pngSt return _tgTypeParser.parseJsonAndGetFile(sendRequest("uploadStickerFile", args)); } -bool Api::createNewStickerSet(std::int32_t userId, const string& name, const string& title, boost::variant<InputFile::Ptr, std::string> pngSticker, const string& emojis, bool containsMasks, MaskPosition::Ptr maskPosition) const { +bool Api::createNewStickerSet(std::int64_t userId, const string& name, const string& title, boost::variant<InputFile::Ptr, std::string> pngSticker, const string& emojis, bool containsMasks, MaskPosition::Ptr maskPosition) const { vector<HttpReqArg> args; args.reserve(7); args.emplace_back("user_id", userId); @@ -342,7 +342,7 @@ bool Api::createNewStickerSet(std::int32_t userId, const string& name, const str return sendRequest("createNewStickerSet", args).get<bool>("", false); } -bool Api::addStickerToSet(std::int32_t userId, const string& name, boost::variant<InputFile::Ptr, std::string> pngSticker, const string& emojis, MaskPosition::Ptr maskPosition) const { +bool Api::addStickerToSet(std::int64_t userId, const string& name, boost::variant<InputFile::Ptr, std::string> pngSticker, const string& emojis, MaskPosition::Ptr maskPosition) const { vector<HttpReqArg> args; args.reserve(6); args.emplace_back("user_id", userId); @@ -698,7 +698,7 @@ void Api::sendChatAction(std::int64_t chatId, const string& action) const { sendRequest("sendChatAction", args); } -UserProfilePhotos::Ptr Api::getUserProfilePhotos(std::int32_t userId, std::int32_t offset, std::int32_t limit) const { +UserProfilePhotos::Ptr Api::getUserProfilePhotos(std::int64_t userId, std::int32_t offset, std::int32_t limit) const { vector<HttpReqArg> args; args.reserve(3); args.emplace_back("user_id", userId); @@ -875,7 +875,7 @@ Message::Ptr Api::editMessageMedia(InputMedia::Ptr media, std::int64_t chatId, s } } -ChatMember::Ptr Api::getChatMember(std::int64_t chatId, std::int32_t userId) const { +ChatMember::Ptr Api::getChatMember(std::int64_t chatId, std::int64_t userId) const { vector<HttpReqArg> args; args.reserve(2); args.emplace_back("chat_id", chatId); @@ -970,7 +970,7 @@ bool Api::answerInlineQuery(const string& inlineQueryId, const std::vector<Inlin return sendRequest("answerInlineQuery", args).get<bool>("", false); } -bool Api::kickChatMember(std::int64_t chatId, std::int32_t userId, std::uint64_t untilDate) const { +bool Api::kickChatMember(std::int64_t chatId, std::int64_t userId, std::uint64_t untilDate) const { vector<HttpReqArg> args; args.reserve(3); args.emplace_back("chat_id", chatId); @@ -981,14 +981,14 @@ bool Api::kickChatMember(std::int64_t chatId, std::int32_t userId, std::uint64_t return sendRequest("kickChatMember", args).get<bool>("", false); } -bool Api::unbanChatMember(std::int64_t chatId, std::int32_t userId) const { +bool Api::unbanChatMember(std::int64_t chatId, std::int64_t userId) const { vector<HttpReqArg> args; args.reserve(2); args.emplace_back("chat_id", chatId); args.emplace_back("user_id", userId); return sendRequest("unbanChatMember", args).get<bool>("", false); } -bool Api::restrictChatMember(std::int64_t chatId, std::int32_t userId, TgBot::ChatPermissions::Ptr permissions, +bool Api::restrictChatMember(std::int64_t chatId, std::int64_t userId, TgBot::ChatPermissions::Ptr permissions, std::uint64_t untilDate) const { vector<HttpReqArg> args; args.reserve(4); @@ -1002,7 +1002,7 @@ bool Api::restrictChatMember(std::int64_t chatId, std::int32_t userId, TgBot::Ch return sendRequest("restrictChatMember", args).get<bool>("", false); } -bool Api::promoteChatMember(std::int64_t chatId, std::int32_t userId, bool canChangeInfo, bool canPostMessages, +bool Api::promoteChatMember(std::int64_t chatId, std::int64_t userId, bool canChangeInfo, bool canPostMessages, bool canEditMessages, bool canDeleteMessages, bool canInviteUsers, bool canPinMessages, bool canPromoteMembers) const { vector<HttpReqArg> args; args.reserve(9); @@ -1096,7 +1096,7 @@ bool Api::unpinChatMessage(std::int64_t chatId) const { return sendRequest("unpinChatMessage", args).get<bool>("", false); } -Message::Ptr Api::setGameScore(std::int32_t userId, std::int32_t score, bool force, bool disableEditMessage, std::int64_t chatId, std::int32_t messageId, const std::string& inlineMessageId) const { +Message::Ptr Api::setGameScore(std::int64_t userId, std::int32_t score, bool force, bool disableEditMessage, std::int64_t chatId, std::int32_t messageId, const std::string& inlineMessageId) const { vector<HttpReqArg> args; args.reserve(7); args.emplace_back("user_id", userId); @@ -1119,7 +1119,7 @@ Message::Ptr Api::setGameScore(std::int32_t userId, std::int32_t score, bool for return _tgTypeParser.parseJsonAndGetMessage(sendRequest("setGameScore", args)); } -vector<GameHighScore::Ptr> Api::getGameHighScores(std::int32_t userId, std::int32_t score, bool force, bool disableEditMessage, std::int64_t chatId, std::int32_t messageId, const std::string& inlineMessageId) const { +vector<GameHighScore::Ptr> Api::getGameHighScores(std::int64_t userId, std::int32_t score, bool force, bool disableEditMessage, std::int64_t chatId, std::int32_t messageId, const std::string& inlineMessageId) const { vector<HttpReqArg> args; args.reserve(7); args.emplace_back("user_id", userId); diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp index 95c60c9..b96068e 100644 --- a/src/TgTypeParser.cpp +++ b/src/TgTypeParser.cpp @@ -63,7 +63,7 @@ string TgTypeParser::parseChat(const Chat::Ptr& object) const { User::Ptr TgTypeParser::parseJsonAndGetUser(const ptree& data) const { auto result(make_shared<User>()); - result->id = data.get<int32_t>("id"); + result->id = data.get<int64_t>("id"); result->isBot = data.get<bool>("is_bot", false); result->firstName = data.get<string>("first_name"); result->lastName = data.get("last_name", ""); @@ -613,7 +613,7 @@ Contact::Ptr TgTypeParser::parseJsonAndGetContact(const ptree& data) const { result->phoneNumber = data.get<string>("phone_number"); result->firstName = data.get<string>("first_name"); result->lastName = data.get("last_name", ""); - result->userId = data.get("user_id", ""); + result->userId = data.get("user_id", 0); result->vcard = data.get("vcard", ""); return result; } @@ -988,7 +988,7 @@ std::string TgTypeParser::parseChatPhoto(const ChatPhoto::Ptr& object) const { ResponseParameters::Ptr TgTypeParser::parseJsonAndGetResponseParameters(const boost::property_tree::ptree& data) const { auto result(make_shared<ResponseParameters>()); - result->migrateToChatId = data.get<int32_t>("migrate_to_chat_id", 0); + result->migrateToChatId = data.get<int64_t>("migrate_to_chat_id", 0); result->retryAfter = data.get<int32_t>("retry_after", 0); return result; } |