answerInlineQuery method

Future<bool> answerInlineQuery(
  1. String inlineQueryId,
  2. List<InlineQueryResult> results, {
  3. int? cacheTime,
  4. bool? isPersonal,
  5. String? nextOffset,
  6. InlineQueryResultsButton? button,
})

Use this method to send answers to an inline query

On success, True is returned.

No more than 50 results per query are allowed.

https://core.telegram.org/bots/api#answerinlinequery

Implementation

Future<bool> answerInlineQuery(
  String inlineQueryId,
  List<InlineQueryResult> results, {
  int? cacheTime,
  bool? isPersonal,
  String? nextOffset,
  InlineQueryResultsButton? button,
}) async {
  var requestUrl = _apiUri('answerInlineQuery');
  var body = <String, dynamic>{
    'inline_query_id': inlineQueryId,
    'results': jsonEncode(results),
    'cache_time': cacheTime,
    'is_personal': isPersonal,
    'next_offset': nextOffset,
    'button': button == null ? null : jsonEncode(button),
  };
  return await HttpClient.httpPost(requestUrl, body: body);
}