inlineQuery_InlineQuery method

Future<Map> inlineQuery_InlineQuery({
  1. required Map inlineQuery,
  2. required TelegramClientData telegramClientData,
  3. bool is_skip_reply_message = false,
  4. required bool is_lite,
  5. bool? isUseCache,
  6. Duration? durationCacheExpire,
})

Implementation

Future<Map> inlineQuery_InlineQuery({
  required Map inlineQuery,
  required TelegramClientData telegramClientData,
  bool is_skip_reply_message = false,
  required bool is_lite,
  bool? isUseCache,
  Duration? durationCacheExpire,
}) async {
  // Map message_inline_message_id = {};
  final Map message_sender_chat_json = <dynamic, dynamic>{};

  if (inlineQuery["sender_user_id"] is int) {
    if (is_lite) {
      message_sender_chat_json["from"] = {
        "id": inlineQuery["sender_user_id"],
      };
    } else {
      final Map res = await request(
        parameters: {
          "@type": "getUser",
          "user_id": inlineQuery["sender_user_id"],
        },
        is_return_as_api: false,
        telegramClientData: telegramClientData,
        isUseCache: isUseCache,
        durationCacheExpire: durationCacheExpire,
      );

      message_sender_chat_json["from"] = res;
    }
  }
  final Map new_scheme_data = <dynamic, dynamic>{
    "id": inlineQuery["id"],
    ...message_sender_chat_json,
  };

  if (inlineQuery["chat_type"] is Map) {
    new_scheme_data["chat_type"] =
        (inlineQuery["chat_type"]["@type"] as String)
            .replaceAll(RegExp(r"(chatType)", caseSensitive: false), "")
            .toLowerCase();
  }
  new_scheme_data["query"] = inlineQuery["query"];
  new_scheme_data["offset"] = inlineQuery["offset"];
  if (inlineQuery["location"] is Map) {
    new_scheme_data["location"] = inlineQuery["location"];
  }
  return new_scheme_data;
}