stopMessageLiveLocation method

Future<Message> stopMessageLiveLocation({
  1. dynamic chat_id,
  2. int? message_id,
  3. String? inline_message_id,
  4. ReplyMarkup? reply_markup,
})
inherited

Use this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires.

On success, if the message was sent by the bot, the sent Message is returned, otherwise True is returned.

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

Implementation

Future<Message> stopMessageLiveLocation(
    {dynamic chat_id,
    int? message_id,
    String? inline_message_id,
    ReplyMarkup? reply_markup}) async {
  if (inline_message_id == null && (chat_id == null || message_id == null)) {
    return Future.error(TelegramException(
        'Require either \'chat_id\' and \'message_id\', or \'inline_message_id\''));
  }
  if (chat_id != null && (chat_id is! String && chat_id is! int)) {
    return Future.error(TelegramException(
        'Attribute \'chat_id\' can only be either type of String or int'));
  }
  var requestUrl = _apiUri('stopMessageLiveLocation');
  var body = <String, dynamic>{
    'chat_id': chat_id,
    'message_id': message_id,
    'inline_message_id': inline_message_id,
    'reply_markup': reply_markup == null ? null : jsonEncode(reply_markup),
  };
  return Message.fromJson(await HttpClient.httpPost(requestUrl, body: body));
}