callbackQuery_CallbackQuery method
Implementation
Future<Map> callbackQuery_CallbackQuery({
required Map callbackQuery,
required TelegramClientData telegramClientData,
bool is_skip_reply_message = false,
required bool is_lite,
bool? isUseCache,
Duration? durationCacheExpire,
}) async {
final Map message_inline_message_id = <dynamic, dynamic>{};
if (callbackQuery.containsKey("inline_message_id")) {
message_inline_message_id["inline_message_id"] =
callbackQuery["inline_message_id"];
}
final Map message_sender_chat_json = <dynamic, dynamic>{};
if (callbackQuery["sender_user_id"] is int) {
if (is_lite) {
message_sender_chat_json["from"] = {
"id": callbackQuery["sender_user_id"],
};
} else {
final Map res = await request(
parameters: {
"@type": "getUser",
"user_id": callbackQuery["sender_user_id"],
},
isUseCache: isUseCache,
durationCacheExpire: durationCacheExpire,
is_return_as_api: false,
telegramClientData: telegramClientData,
);
message_sender_chat_json["from"] = res;
}
}
final Map message_chat_json = <dynamic, dynamic>{};
if (callbackQuery["chat_id"] is int) {
if (is_lite) {
message_chat_json["chat"] = {
"id": callbackQuery["chat_id"],
};
} else {
final Map res = await request(
parameters: {
"@type": "getChat",
"chat_id": callbackQuery["chat_id"],
},
isUseCache: isUseCache,
durationCacheExpire: durationCacheExpire,
is_return_as_api: false,
telegramClientData: telegramClientData,
);
message_chat_json["chat"] = res;
}
}
final Map new_scheme_data = <dynamic, dynamic>{
"id": callbackQuery["id"],
...message_inline_message_id,
...message_sender_chat_json,
...message_chat_json,
};
if (callbackQuery["message_id"] is int) {
final Map message_reply_to = await invoke(
parameters: {
"@type": "getMessageLocally",
"chat_id": callbackQuery["chat_id"],
"message_id": callbackQuery["message_id"],
},
isUseCache: isUseCache,
durationCacheExpire: durationCacheExpire,
telegramClientData: telegramClientData,
);
new_scheme_data["message"] = await message_Message(
message: message_reply_to,
telegramClientData: telegramClientData,
is_skip_reply_message: true,
is_lite: is_lite,
isUseCache: isUseCache,
durationCacheExpire: durationCacheExpire,
);
}
new_scheme_data["chat_instance"] = callbackQuery["chat_instance"];
new_scheme_data["data"] =
utf8.decode(base64.decode(callbackQuery["payload"]["data"]));
return new_scheme_data;
}