From 5492d26d21d09dc9cc3551f32a8eab7a2e783e3c Mon Sep 17 00:00:00 2001 From: llnulldisk <48621230+llnulldisk@users.noreply.github.com> Date: Sun, 4 Sep 2022 20:33:21 +0200 Subject: Update to API 5.3 --- src/Api.cpp | 61 +++++-- src/TgTypeParser.cpp | 369 ++++++++++++++++++++++++++++++++++++++++-- src/types/BotCommandScope.cpp | 19 +++ src/types/ChatMember.cpp | 17 ++ 4 files changed, 436 insertions(+), 30 deletions(-) create mode 100644 src/types/BotCommandScope.cpp create mode 100644 src/types/ChatMember.cpp (limited to 'src') diff --git a/src/Api.cpp b/src/Api.cpp index 5cdab54..9fdf290 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -935,10 +935,10 @@ string Api::downloadFile(const string& filePath, const std::vector& return serverResponse; } -bool Api::kickChatMember(std::int64_t chatId, - std::int64_t userId, - std::uint64_t untilDate, - bool revokeMessages) const { +bool Api::banChatMember(std::int64_t chatId, + std::int64_t userId, + std::uint64_t untilDate, + bool revokeMessages) const { vector args; args.reserve(4); @@ -947,7 +947,7 @@ bool Api::kickChatMember(std::int64_t chatId, args.emplace_back("until_date", untilDate); args.emplace_back("revoke_messages", revokeMessages); - return sendRequest("kickChatMember", args).get("", false); + return sendRequest("banChatMember", args).get("", false); } bool Api::unbanChatMember(std::int64_t chatId, std::int64_t userId, bool onlyIfBanned) const { @@ -1187,11 +1187,13 @@ vector Api::getChatAdministrators(std::int64_t chatId) const { return _tgTypeParser.parseJsonAndGetArray(&TgTypeParser::parseJsonAndGetChatMember, sendRequest("getChatAdministrators", args)); } -int32_t Api::getChatMembersCount(std::int64_t chatId) const { +int32_t Api::getChatMemberCount(std::int64_t chatId) const { vector args; args.reserve(1); + args.emplace_back("chat_id", chatId); - return sendRequest("getChatMembersCount", args).get("", 0); + + return sendRequest("getChatMemberCount", args).get("", 0); } ChatMember::Ptr Api::getChatMember(std::int64_t chatId, std::int64_t userId) const { @@ -1236,18 +1238,51 @@ bool Api::answerCallbackQuery(const string& callbackQueryId, const string& text, return sendRequest("answerCallbackQuery", args).get("", false); } -bool Api::setMyCommands(const std::vector& commands) const { +bool Api::setMyCommands(const std::vector& commands, + BotCommandScope::Ptr scope, + const std::string& languageCode) const { vector args; - args.reserve(5); + args.reserve(3); - string commandsJson = _tgTypeParser.parseArray(&TgTypeParser::parseBotCommand, commands); - args.emplace_back("commands", commandsJson); + args.emplace_back("commands", _tgTypeParser.parseArray(&TgTypeParser::parseBotCommand, commands)); + if (scope != nullptr) { + args.emplace_back("scope", _tgTypeParser.parseBotCommandScope(scope)); + } + if (!languageCode.empty()) { + args.emplace_back("language_code", languageCode); + } return sendRequest("setMyCommands", args).get("", false); } -std::vector Api::getMyCommands() const { - return _tgTypeParser.parseJsonAndGetArray(&TgTypeParser::parseJsonAndGetBotCommand, sendRequest("getMyCommands")); +bool Api::deleteMyCommands(BotCommandScope::Ptr scope, + const std::string& languageCode) const { + vector args; + args.reserve(2); + + if (scope != nullptr) { + args.emplace_back("scope", _tgTypeParser.parseBotCommandScope(scope)); + } + if (!languageCode.empty()) { + args.emplace_back("language_code", languageCode); + } + + return sendRequest("deleteMyCommands", args).get("", false); +} + +std::vector Api::getMyCommands(BotCommandScope::Ptr scope, + const std::string& languageCode) const { + vector args; + args.reserve(2); +; + if (scope != nullptr) { + args.emplace_back("scope", _tgTypeParser.parseBotCommandScope(scope)); + } + if (!languageCode.empty()) { + args.emplace_back("language_code", languageCode); + } + + return _tgTypeParser.parseJsonAndGetArray(&TgTypeParser::parseJsonAndGetBotCommand, sendRequest("getMyCommands", args)); } Message::Ptr Api::editMessageText(const std::string& text, diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp index 48b542a..330278a 100644 --- a/src/TgTypeParser.cpp +++ b/src/TgTypeParser.cpp @@ -1247,6 +1247,7 @@ ReplyKeyboardMarkup::Ptr TgTypeParser::parseJsonAndGetReplyKeyboardMarkup(const } result->resizeKeyboard = data.get("resize_keyboard", false); result->oneTimeKeyboard = data.get("one_time_keyboard", false); + result->inputFieldPlaceholder = data.get("input_field_placeholder", ""); result->selective = data.get("selective", false); return result; } @@ -1272,6 +1273,7 @@ std::string TgTypeParser::parseReplyKeyboardMarkup(const ReplyKeyboardMarkup::Pt result += "],"; appendToJson(result, "resize_keyboard", object->resizeKeyboard); appendToJson(result, "one_time_keyboard", object->oneTimeKeyboard); + appendToJson(result, "input_field_placeholder", object->inputFieldPlaceholder); appendToJson(result, "selective", object->selective); removeLastComma(result); result += '}'; @@ -1341,7 +1343,8 @@ std::string TgTypeParser::parseReplyKeyboardRemove(const ReplyKeyboardRemove::Pt ForceReply::Ptr TgTypeParser::parseJsonAndGetForceReply(const boost::property_tree::ptree& data) const { auto result(std::make_shared()); - result->selective = data.get("selective"); + result->inputFieldPlaceholder = data.get("input_field_placeholder", ""); + result->selective = data.get("selective", false); return result; } @@ -1352,6 +1355,7 @@ std::string TgTypeParser::parseForceReply(const ForceReply::Ptr& object) const { std::string result; result += '{'; appendToJson(result, "force_reply", object->forceReply); + appendToJson(result, "input_field_placeholder", object->inputFieldPlaceholder); appendToJson(result, "selective", object->selective); removeLastComma(result); result += '}'; @@ -1359,12 +1363,86 @@ std::string TgTypeParser::parseForceReply(const ForceReply::Ptr& object) const { } ChatMember::Ptr TgTypeParser::parseJsonAndGetChatMember(const boost::property_tree::ptree& data) const { - auto result(std::make_shared()); + std::string status = data.get("status", ""); + ChatMember::Ptr result; + + if (status == ChatMemberOwner::STATUS) { + result = std::static_pointer_cast(parseJsonAndGetChatMemberOwner(data)); + } else if (status == ChatMemberAdministrator::STATUS) { + result = std::static_pointer_cast(parseJsonAndGetChatMemberAdministrator(data)); + } else if (status == ChatMemberMember::STATUS) { + result = std::static_pointer_cast(parseJsonAndGetChatMemberMember(data)); + } else if (status == ChatMemberRestricted::STATUS) { + result = std::static_pointer_cast(parseJsonAndGetChatMemberRestricted(data)); + } else if (status == ChatMemberLeft::STATUS) { + result = std::static_pointer_cast(parseJsonAndGetChatMemberLeft(data)); + } else if (status == ChatMemberBanned::STATUS) { + result = std::static_pointer_cast(parseJsonAndGetChatMemberBanned(data)); + } else { + result = std::make_shared(); + } + + result->status = status; result->user = tryParseJson(&TgTypeParser::parseJsonAndGetUser, data, "user"); - result->status = data.get("status", ""); + + return result; +} + +std::string TgTypeParser::parseChatMember(const ChatMember::Ptr& object) const { + if (!object) { + return ""; + } + std::string result; + result += '{'; + appendToJson(result, "status", object->status); + appendToJson(result, "user", parseUser(object->user)); + + if (object->status == ChatMemberOwner::STATUS) { + result += parseChatMemberOwner(std::static_pointer_cast(object)); + } else if (object->status == ChatMemberAdministrator::STATUS) { + result += parseChatMemberAdministrator(std::static_pointer_cast(object)); + } else if (object->status == ChatMemberMember::STATUS) { + result += parseChatMemberMember(std::static_pointer_cast(object)); + } else if (object->status == ChatMemberRestricted::STATUS) { + result += parseChatMemberRestricted(std::static_pointer_cast(object)); + } else if (object->status == ChatMemberLeft::STATUS) { + result += parseChatMemberLeft(std::static_pointer_cast(object)); + } else if (object->status == ChatMemberBanned::STATUS) { + result += parseChatMemberBanned(std::static_pointer_cast(object)); + } + + removeLastComma(result); + result += '}'; + return result; +} + +ChatMemberOwner::Ptr TgTypeParser::parseJsonAndGetChatMemberOwner(const boost::property_tree::ptree& data) const { + // NOTE: This function will be called by parseJsonAndGetChatMember(). + auto result(std::make_shared()); result->customTitle = data.get("custom_title", ""); result->isAnonymous = data.get("is_anonymous", false); + return result; +} + +std::string TgTypeParser::parseChatMemberOwner(const ChatMemberOwner::Ptr& object) const { + if (!object) { + return ""; + } + // This function will be called by parseChatMember(), so I don't add + // curly brackets to the result std::string. + std::string result; + appendToJson(result, "custom_title", object->customTitle); + appendToJson(result, "is_anonymous", object->isAnonymous); + // The last comma will be erased by parseChatMember(). + return result; +} + +ChatMemberAdministrator::Ptr TgTypeParser::parseJsonAndGetChatMemberAdministrator(const boost::property_tree::ptree& data) const { + // NOTE: This function will be called by parseJsonAndGetChatMember(). + auto result(std::make_shared()); result->canBeEdited = data.get("can_be_edited", false); + result->customTitle = data.get("custom_title", ""); + result->isAnonymous = data.get("is_anonymous", false); result->canManageChat = data.get("can_manage_chat", false); result->canPostMessages = data.get("can_post_messages", false); result->canEditMessages = data.get("can_edit_messages", false); @@ -1375,27 +1453,19 @@ ChatMember::Ptr TgTypeParser::parseJsonAndGetChatMember(const boost::property_tr result->canChangeInfo = data.get("can_change_info", false); result->canInviteUsers = data.get("can_invite_users", false); result->canPinMessages = data.get("can_pin_messages", false); - result->isMember = data.get("is_member", false); - result->canSendMessages = data.get("can_send_messages", false); - result->canSendMediaMessages = data.get("can_send_media_messages", false); - result->canSendPolls = data.get("can_send_polls", false); - result->canSendOtherMessages = data.get("can_send_other_messages", false); - result->canAddWebPagePreviews = data.get("can_add_web_page_previews", false); - result->untilDate = data.get("until_date", 0); return result; } -std::string TgTypeParser::parseChatMember(const ChatMember::Ptr& object) const { +std::string TgTypeParser::parseChatMemberAdministrator(const ChatMemberAdministrator::Ptr& object) const { if (!object) { return ""; } + // This function will be called by parseChatMember(), so I don't add + // curly brackets to the result std::string. std::string result; - result += '{'; - appendToJson(result, "user", parseUser(object->user)); - appendToJson(result, "status", object->status); + appendToJson(result, "can_be_edited", object->canBeEdited); appendToJson(result, "custom_title", object->customTitle); appendToJson(result, "is_anonymous", object->isAnonymous); - appendToJson(result, "can_be_edited", object->canBeEdited); appendToJson(result, "can_manage_chat", object->canManageChat); appendToJson(result, "can_post_messages", object->canPostMessages); appendToJson(result, "can_edit_messages", object->canEditMessages); @@ -1406,15 +1476,97 @@ std::string TgTypeParser::parseChatMember(const ChatMember::Ptr& object) const { appendToJson(result, "can_change_info", object->canChangeInfo); appendToJson(result, "can_invite_users", object->canInviteUsers); appendToJson(result, "can_pin_messages", object->canPinMessages); + // The last comma will be erased by parseChatMember(). + return result; +} + +ChatMemberMember::Ptr TgTypeParser::parseJsonAndGetChatMemberMember(const boost::property_tree::ptree& data) const { + // NOTE: This function will be called by parseJsonAndGetChatMember(). + auto result(std::make_shared()); + return result; +} + +std::string TgTypeParser::parseChatMemberMember(const ChatMemberMember::Ptr& object) const { + if (!object) { + return ""; + } + // This function will be called by parseChatMember(), so I don't add + // curly brackets to the result std::string. + std::string result; + // The last comma will be erased by parseChatMember(). + return result; +} + +ChatMemberRestricted::Ptr TgTypeParser::parseJsonAndGetChatMemberRestricted(const boost::property_tree::ptree& data) const { + // NOTE: This function will be called by parseJsonAndGetChatMember(). + auto result(std::make_shared()); + result->isMember = data.get("is_member", false); + result->canChangeInfo = data.get("can_change_info", false); + result->canInviteUsers = data.get("can_invite_users", false); + result->canPinMessages = data.get("can_pin_messages", false); + result->canSendMessages = data.get("can_send_messages", false); + result->canSendMediaMessages = data.get("can_send_media_messages", false); + result->canSendPolls = data.get("can_send_polls", false); + result->canSendOtherMessages = data.get("can_send_other_messages", false); + result->canAddWebPagePreviews = data.get("can_add_web_page_previews", false); + result->untilDate = data.get("until_date", 0); + return result; +} + +std::string TgTypeParser::parseChatMemberRestricted(const ChatMemberRestricted::Ptr& object) const { + if (!object) { + return ""; + } + // This function will be called by parseChatMember(), so I don't add + // curly brackets to the result std::string. + std::string result; appendToJson(result, "is_member", object->isMember); + appendToJson(result, "can_change_info", object->canChangeInfo); + appendToJson(result, "can_invite_users", object->canInviteUsers); + appendToJson(result, "can_pin_messages", object->canPinMessages); appendToJson(result, "can_send_messages", object->canSendMessages); appendToJson(result, "can_send_media_messages", object->canSendMediaMessages); appendToJson(result, "can_send_polls", object->canSendPolls); appendToJson(result, "can_send_other_messages", object->canSendOtherMessages); appendToJson(result, "can_add_web_page_previews", object->canAddWebPagePreviews); appendToJson(result, "until_date", object->untilDate); - removeLastComma(result); - result += '}'; + // The last comma will be erased by parseChatMember(). + return result; +} + +ChatMemberLeft::Ptr TgTypeParser::parseJsonAndGetChatMemberLeft(const boost::property_tree::ptree& data) const { + // NOTE: This function will be called by parseJsonAndGetChatMember(). + auto result(std::make_shared()); + return result; +} + +std::string TgTypeParser::parseChatMemberLeft(const ChatMemberLeft::Ptr& object) const { + if (!object) { + return ""; + } + // This function will be called by parseChatMember(), so I don't add + // curly brackets to the result std::string. + std::string result; + // The last comma will be erased by parseChatMember(). + return result; +} + +ChatMemberBanned::Ptr TgTypeParser::parseJsonAndGetChatMemberBanned(const boost::property_tree::ptree& data) const { + // NOTE: This function will be called by parseJsonAndGetChatMember(). + auto result(std::make_shared()); + result->untilDate = data.get("until_date", 0); + return result; +} + +std::string TgTypeParser::parseChatMemberBanned(const ChatMemberBanned::Ptr& object) const { + if (!object) { + return ""; + } + // This function will be called by parseChatMember(), so I don't add + // curly brackets to the result std::string. + std::string result; + appendToJson(result, "until_date", object->untilDate); + // The last comma will be erased by parseChatMember(). return result; } @@ -2793,6 +2945,189 @@ std::string TgTypeParser::parseBotCommand(const BotCommand::Ptr& object) const { return result; } +BotCommandScope::Ptr TgTypeParser::parseJsonAndGetBotCommandScope(const boost::property_tree::ptree& data) const { + std::string type = data.get("type", ""); + BotCommandScope::Ptr result; + + if (type == BotCommandScopeDefault::TYPE) { + result = std::static_pointer_cast(parseJsonAndGetBotCommandScopeDefault(data)); + } else if (type == BotCommandScopeAllPrivateChats::TYPE) { + result = std::static_pointer_cast(parseJsonAndGetBotCommandScopeAllPrivateChats(data)); + } else if (type == BotCommandScopeAllGroupChats::TYPE) { + result = std::static_pointer_cast(parseJsonAndGetBotCommandScopeAllGroupChats(data)); + } else if (type == BotCommandScopeAllChatAdministrators::TYPE) { + result = std::static_pointer_cast(parseJsonAndGetBotCommandScopeAllChatAdministrators(data)); + } else if (type == BotCommandScopeChat::TYPE) { + result = std::static_pointer_cast(parseJsonAndGetBotCommandScopeChat(data)); + } else if (type == BotCommandScopeChatAdministrators::TYPE) { + result = std::static_pointer_cast(parseJsonAndGetBotCommandScopeChatAdministrators(data)); + } else if (type == BotCommandScopeChatMember::TYPE) { + result = std::static_pointer_cast(parseJsonAndGetBotCommandScopeChatMember(data)); + } else { + result = std::make_shared(); + } + + result->type = type; + + return result; +} + +std::string TgTypeParser::parseBotCommandScope(const BotCommandScope::Ptr& object) const { + if (!object) { + return ""; + } + std::string result; + result += '{'; + appendToJson(result, "type", object->type); + + if (object->type == BotCommandScopeDefault::TYPE) { + result += parseBotCommandScopeDefault(std::static_pointer_cast(object)); + } else if (object->type == BotCommandScopeAllPrivateChats::TYPE) { + result += parseBotCommandScopeAllPrivateChats(std::static_pointer_cast(object)); + } else if (object->type == BotCommandScopeAllGroupChats::TYPE) { + result += parseBotCommandScopeAllGroupChats(std::static_pointer_cast(object)); + } else if (object->type == BotCommandScopeAllChatAdministrators::TYPE) { + result += parseBotCommandScopeAllChatAdministrators(std::static_pointer_cast(object)); + } else if (object->type == BotCommandScopeChat::TYPE) { + result += parseBotCommandScopeChat(std::static_pointer_cast(object)); + } else if (object->type == BotCommandScopeChatAdministrators::TYPE) { + result += parseBotCommandScopeChatAdministrators(std::static_pointer_cast(object)); + } else if (object->type == BotCommandScopeChatMember::TYPE) { + result += parseBotCommandScopeChatMember(std::static_pointer_cast(object)); + } + + removeLastComma(result); + result += '}'; + return result; +} + +BotCommandScopeDefault::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeDefault(const boost::property_tree::ptree& data) const { + // NOTE: This function will be called by parseJsonAndGetBotCommandScope(). + auto result(std::make_shared()); + return result; +} + +std::string TgTypeParser::parseBotCommandScopeDefault(const BotCommandScopeDefault::Ptr& object) const { + if (!object) { + return ""; + } + // This function will be called by parseBotCommandScope(), so I don't add + // curly brackets to the result std::string. + std::string result; + // The last comma will be erased by parseBotCommandScope(). + return result; +} + +BotCommandScopeAllPrivateChats::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeAllPrivateChats(const boost::property_tree::ptree& data) const { + // NOTE: This function will be called by parseJsonAndGetBotCommandScope(). + auto result(std::make_shared()); + return result; +} + +std::string TgTypeParser::parseBotCommandScopeAllPrivateChats(const BotCommandScopeAllPrivateChats::Ptr& object) const { + if (!object) { + return ""; + } + // This function will be called by parseBotCommandScope(), so I don't add + // curly brackets to the result std::string. + std::string result; + // The last comma will be erased by parseBotCommandScope(). + return result; +} + +BotCommandScopeAllGroupChats::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeAllGroupChats(const boost::property_tree::ptree& data) const { + // NOTE: This function will be called by parseJsonAndGetBotCommandScope(). + auto result(std::make_shared()); + return result; +} + +std::string TgTypeParser::parseBotCommandScopeAllGroupChats(const BotCommandScopeAllGroupChats::Ptr& object) const { + if (!object) { + return ""; + } + // This function will be called by parseBotCommandScope(), so I don't add + // curly brackets to the result std::string. + std::string result; + // The last comma will be erased by parseBotCommandScope(). + return result; +} + +BotCommandScopeAllChatAdministrators::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeAllChatAdministrators(const boost::property_tree::ptree& data) const { + // NOTE: This function will be called by parseJsonAndGetBotCommandScope(). + auto result(std::make_shared()); + return result; +} + +std::string TgTypeParser::parseBotCommandScopeAllChatAdministrators(const BotCommandScopeAllChatAdministrators::Ptr& object) const { + if (!object) { + return ""; + } + // This function will be called by parseBotCommandScope(), so I don't add + // curly brackets to the result std::string. + std::string result; + // The last comma will be erased by parseBotCommandScope(). + return result; +} + +BotCommandScopeChat::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeChat(const boost::property_tree::ptree& data) const { + // NOTE: This function will be called by parseJsonAndGetBotCommandScope(). + auto result(std::make_shared()); + result->chatId = data.get("chat_id", 0); + return result; +} + +std::string TgTypeParser::parseBotCommandScopeChat(const BotCommandScopeChat::Ptr& object) const { + if (!object) { + return ""; + } + // This function will be called by parseBotCommandScope(), so I don't add + // curly brackets to the result std::string. + std::string result; + appendToJson(result, "chat_id", object->chatId); + // The last comma will be erased by parseBotCommandScope(). + return result; +} + +BotCommandScopeChatAdministrators::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeChatAdministrators(const boost::property_tree::ptree& data) const { + // NOTE: This function will be called by parseJsonAndGetBotCommandScope(). + auto result(std::make_shared()); + result->chatId = data.get("chat_id", 0); + return result; +} + +std::string TgTypeParser::parseBotCommandScopeChatAdministrators(const BotCommandScopeChatAdministrators::Ptr& object) const { + if (!object) { + return ""; + } + // This function will be called by parseBotCommandScope(), so I don't add + // curly brackets to the result std::string. + std::string result; + appendToJson(result, "chat_id", object->chatId); + // The last comma will be erased by parseBotCommandScope(). + return result; +} + +BotCommandScopeChatMember::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeChatMember(const boost::property_tree::ptree& data) const { + // NOTE: This function will be called by parseJsonAndGetBotCommandScope(). + auto result(std::make_shared()); + result->chatId = data.get("chat_id", 0); + result->userId = data.get("user_id", 0); + return result; +} + +std::string TgTypeParser::parseBotCommandScopeChatMember(const BotCommandScopeChatMember::Ptr& object) const { + if (!object) { + return ""; + } + // This function will be called by parseBotCommandScope(), so I don't add + // curly brackets to the result std::string. + std::string result; + appendToJson(result, "chat_id", object->chatId); + appendToJson(result, "user_id", object->userId); + // The last comma will be erased by parseBotCommandScope(). + return result; +} + OrderInfo::Ptr TgTypeParser::parseJsonAndGetOrderInfo(const boost::property_tree::ptree& data) const { auto result(std::make_shared()); result->name = data.get("name", ""); diff --git a/src/types/BotCommandScope.cpp b/src/types/BotCommandScope.cpp new file mode 100644 index 0000000..0e52dd8 --- /dev/null +++ b/src/types/BotCommandScope.cpp @@ -0,0 +1,19 @@ +#include "tgbot/types/BotCommandScopeDefault.h" +#include "tgbot/types/BotCommandScopeAllPrivateChats.h" +#include "tgbot/types/BotCommandScopeAllGroupChats.h" +#include "tgbot/types/BotCommandScopeAllChatAdministrators.h" +#include "tgbot/types/BotCommandScopeChat.h" +#include "tgbot/types/BotCommandScopeChatAdministrators.h" +#include "tgbot/types/BotCommandScopeChatMember.h" + +#include + +using namespace TgBot; + +const std::string BotCommandScopeDefault::TYPE = "default"; +const std::string BotCommandScopeAllPrivateChats::TYPE = "all_private_chats"; +const std::string BotCommandScopeAllGroupChats::TYPE = "all_group_chats"; +const std::string BotCommandScopeAllChatAdministrators::TYPE = "all_chat_administrators"; +const std::string BotCommandScopeChat::TYPE = "chat"; +const std::string BotCommandScopeChatAdministrators::TYPE = "chat_administrators"; +const std::string BotCommandScopeChatMember::TYPE = "chat_member"; diff --git a/src/types/ChatMember.cpp b/src/types/ChatMember.cpp new file mode 100644 index 0000000..7f5b704 --- /dev/null +++ b/src/types/ChatMember.cpp @@ -0,0 +1,17 @@ +#include "tgbot/types/ChatMemberOwner.h" +#include "tgbot/types/ChatMemberAdministrator.h" +#include "tgbot/types/ChatMemberMember.h" +#include "tgbot/types/ChatMemberRestricted.h" +#include "tgbot/types/ChatMemberLeft.h" +#include "tgbot/types/ChatMemberBanned.h" + +#include + +using namespace TgBot; + +const std::string ChatMemberOwner::STATUS = "creator"; +const std::string ChatMemberAdministrator::STATUS = "administrator"; +const std::string ChatMemberMember::STATUS = "member"; +const std::string ChatMemberRestricted::STATUS = "restricted"; +const std::string ChatMemberLeft::STATUS = "left"; +const std::string ChatMemberBanned::STATUS = "kicked"; -- cgit v1.2.3