forwardMessage method

Future<Message> forwardMessage(
  1. dynamic chat_id,
  2. int from_chat_id,
  3. int message_id, {
  4. bool? disable_notification,
})
inherited

Use this method to forward messages of any kind. On success, the sent Message is returned.

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

Implementation

Future<Message> forwardMessage(
    dynamic chat_id, int from_chat_id, int message_id,
    {bool? disable_notification}) async {
  if (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('forwardMessage');
  var body = <String, dynamic>{
    'chat_id': chat_id,
    'from_chat_id': from_chat_id,
    'message_id': message_id,
    'disable_notification': disable_notification,
  };
  return Message.fromJson(await HttpClient.httpPost(requestUrl, body: body));
}