tgbotxx 1.1.6.9
Telegram Bot C++ Library
Loading...
Searching...
No Matches
KeyboardButtonRequestChat.hpp
Go to the documentation of this file.
1#pragma once
4
5namespace tgbotxx {
12 explicit KeyboardButtonRequestChat(const nl::json& json) {
13 fromJson(json);
14 }
15
18 std::int32_t requestId{};
19
22
26
30
33
38
43
46
47
50 nl::json toJson() const {
51 nl::json json = nl::json::object();
52 OBJECT_SERIALIZE_FIELD(json, "request_id", requestId);
53 OBJECT_SERIALIZE_FIELD(json, "chat_is_channel", chatIsChannel);
54 OBJECT_SERIALIZE_FIELD(json, "chat_is_forum", chatIsForum);
55 OBJECT_SERIALIZE_FIELD(json, "chat_has_username", chatHasUsername);
56 OBJECT_SERIALIZE_FIELD(json, "chat_is_created", chatIsCreated);
57 OBJECT_SERIALIZE_FIELD_PTR(json, "user_administrator_rights", userAdministratorRights);
58 OBJECT_SERIALIZE_FIELD_PTR(json, "bot_administrator_rights", botAdministratorRights);
59 OBJECT_SERIALIZE_FIELD(json, "bot_is_member", botIsMember);
60 return json;
61 }
62
64 void fromJson(const nl::json& json) {
65 OBJECT_DESERIALIZE_FIELD(json, "request_id", requestId, 0, false);
66 OBJECT_DESERIALIZE_FIELD(json, "chat_is_channel", chatIsChannel, false, false);
67 OBJECT_DESERIALIZE_FIELD(json, "chat_is_forum", chatIsForum, false, true);
68 OBJECT_DESERIALIZE_FIELD(json, "chat_has_username", chatHasUsername, false, true);
69 OBJECT_DESERIALIZE_FIELD(json, "chat_is_created", chatIsCreated, false, true);
70 OBJECT_DESERIALIZE_FIELD_PTR(json, "user_administrator_rights", userAdministratorRights, true);
71 OBJECT_DESERIALIZE_FIELD_PTR(json, "bot_administrator_rights", botAdministratorRights, true);
72 OBJECT_DESERIALIZE_FIELD(json, "bot_is_member", botIsMember, false, true);
73 }
74 };
75}
#define OBJECT_SERIALIZE_FIELD_PTR(json, json_field, field)
Definition Object.hpp:22
#define OBJECT_DESERIALIZE_FIELD_PTR(json, json_field, field, optional)
Definition Object.hpp:70
#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:44
std::shared_ptr< T > Ptr
Definition Ptr.hpp:6
This object defines the criteria used to request a suitable chat. The identifier of the selected chat...
Ptr< ChatAdministratorRights > userAdministratorRights
Optional. A JSON-serialized object listing the required administrator rights of the user in the chat....
bool chatHasUsername
Optional. Pass True to request a supergroup or a channel with a username, pass False to request a cha...
nl::json toJson() const
Serializes this object to JSON.
void fromJson(const nl::json &json)
Deserializes this object from JSON.
bool chatIsCreated
Optional. Pass True to request a chat owned by the user. Otherwise, no additional restrictions are ap...
bool chatIsForum
Optional. Pass True to request a forum supergroup, pass False to request a non-forum chat....
bool chatIsChannel
Pass True to request a channel chat, pass False to request a group or a supergroup chat.
Ptr< ChatAdministratorRights > botAdministratorRights
Optional. A JSON-serialized object listing the required administrator rights of the bot in the chat....
std::int32_t requestId
Signed 32-bit identifier of the request, which will be received back in the ChatShared object.
bool botIsMember
Optional. Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions...