tgbotxx 1.1.9.2
Telegram Bot C++ Library
Loading...
Searching...
No Matches
BusinessBotRights.hpp
Go to the documentation of this file.
1#pragma once
3
4namespace tgbotxx {
5
9 BusinessBotRights() = default;
10 explicit BusinessBotRights(const nl::json& json) {
11 fromJson(json);
12 }
13
15 bool canReply{};
16
19
22
25
28
30 bool canEditBio{};
31
34
37
40
43
46
49
52
55
58 nl::json toJson() const {
59 nl::json json = nl::json::object();
60 OBJECT_SERIALIZE_FIELD(json, "can_reply", canReply);
61 OBJECT_SERIALIZE_FIELD(json, "can_read_messages", canReadMessages);
62 OBJECT_SERIALIZE_FIELD(json, "can_delete_sent_messages", canDeleteSentMessages);
63 OBJECT_SERIALIZE_FIELD(json, "can_delete_all_messages", canDeleteAllMessages);
64 OBJECT_SERIALIZE_FIELD(json, "can_edit_name", canEditName);
65 OBJECT_SERIALIZE_FIELD(json, "can_edit_bio", canEditBio);
66 OBJECT_SERIALIZE_FIELD(json, "can_edit_profile_photo", canEditProfilePhoto);
67 OBJECT_SERIALIZE_FIELD(json, "can_edit_username", canEditUsername);
68 OBJECT_SERIALIZE_FIELD(json, "can_change_gift_settings", canChangeGiftSettings);
69 OBJECT_SERIALIZE_FIELD(json, "can_view_gifts_and_stars", canViewGiftsAndStars);
70 OBJECT_SERIALIZE_FIELD(json, "can_convert_gifts_to_stars", canConvertGiftsToStars);
71 OBJECT_SERIALIZE_FIELD(json, "can_transfer_and_upgrade_gifts", canTransferAndUpgradeGifts);
72 OBJECT_SERIALIZE_FIELD(json, "can_transfer_stars", canTransferStars);
73 OBJECT_SERIALIZE_FIELD(json, "can_manage_stories", canManageStories);
74 return json;
75 }
76
78 void fromJson(const nl::json& json) {
79 OBJECT_DESERIALIZE_FIELD(json, "can_reply", canReply, false, true);
80 OBJECT_DESERIALIZE_FIELD(json, "can_read_messages", canReadMessages, false, true);
81 OBJECT_DESERIALIZE_FIELD(json, "can_delete_sent_messages", canDeleteSentMessages, false, true);
82 OBJECT_DESERIALIZE_FIELD(json, "can_delete_all_messages", canDeleteAllMessages, false, true);
83 OBJECT_DESERIALIZE_FIELD(json, "can_edit_name", canEditName, false, true);
84 OBJECT_DESERIALIZE_FIELD(json, "can_edit_bio", canEditBio, false, true);
85 OBJECT_DESERIALIZE_FIELD(json, "can_edit_profile_photo", canEditProfilePhoto, false, true);
86 OBJECT_DESERIALIZE_FIELD(json, "can_edit_username", canEditUsername, false, true);
87 OBJECT_DESERIALIZE_FIELD(json, "can_change_gift_settings", canChangeGiftSettings, false, true);
88 OBJECT_DESERIALIZE_FIELD(json, "can_view_gifts_and_stars", canViewGiftsAndStars, false, true);
89 OBJECT_DESERIALIZE_FIELD(json, "can_convert_gifts_to_stars", canConvertGiftsToStars, false, true);
90 OBJECT_DESERIALIZE_FIELD(json, "can_transfer_and_upgrade_gifts", canTransferAndUpgradeGifts, false, true);
91 OBJECT_DESERIALIZE_FIELD(json, "can_transfer_stars", canTransferStars, false, true);
92 OBJECT_DESERIALIZE_FIELD(json, "can_manage_stories", canManageStories, false, true);
93 }
94 };
95
96}
#define OBJECT_SERIALIZE_FIELD(json, json_field, field)
Available objects: https://core.telegram.org/bots/api#available-types.
Definition Object.hpp:19
#define OBJECT_DESERIALIZE_FIELD(json, json_field, field, default_value, optional)
Deserialize.
Definition Object.hpp:46
Represents the rights of a business bot. https://core.telegram.org/bots/api#businessbotrights.
bool canDeleteAllMessages
Optional. True, if the bot can delete all private messages in managed chats.
bool canEditBio
Optional. True, if the bot can edit the bio of the business account.
bool canChangeGiftSettings
Optional. True, if the bot can change the privacy settings pertaining to gifts for the business accou...
void fromJson(const nl::json &json)
Deserializes this object from JSON.
nl::json toJson() const
Serializes this object to JSON.
bool canEditUsername
Optional. True, if the bot can edit the username of the business account.
bool canDeleteSentMessages
Optional. True, if the bot can delete messages sent by the bot.
bool canEditName
Optional. True, if the bot can edit the first and last name of the business account.
bool canManageStories
Optional. True, if the bot can post, edit, and delete stories on behalf of the business account.
bool canTransferStars
Optional. True, if the bot can transfer Telegram Stars received by the business account to its own ac...
bool canEditProfilePhoto
Optional. True, if the bot can edit the profile photo of the business account.
bool canReadMessages
Optional. True, if the bot can mark incoming private messages as read.
BusinessBotRights(const nl::json &json)
bool canTransferAndUpgradeGifts
Optional. True, if the bot can transfer and upgrade gifts owned by the business account.
bool canReply
Optional. True, if the bot can send and edit messages in private chats that had incoming messages in ...
bool canConvertGiftsToStars
Optional. True, if the bot can convert regular gifts owned by the business account to Telegram Stars.
bool canViewGiftsAndStars
Optional. True, if the bot can view gifts and the amount of Telegram Stars owned by the business acco...