copyMessage method
Future<MessageId>
copyMessage(
- dynamic chat_id,
- int from_chat_id,
- int message_id, {
- String? parse_mode,
- bool? disable_notification,
- int? reply_to_message_id,
- bool? allow_sending_without_reply,
- ReplyMarkup? reply_markup,
inherited
Use this method to copy messages of any kind
The method is analogous to the method forwardMessage,
but the copied message doesn't have a link to the original message.
Returns the MessageId
of the sent message on success.
Implementation
Future<MessageId> copyMessage(
dynamic chat_id,
int from_chat_id,
int message_id, {
String? caption,
String? parse_mode,
List<MessageEntity>? caption_entities,
bool? disable_notification,
int? reply_to_message_id,
bool? allow_sending_without_reply,
ReplyMarkup? reply_markup,
}) 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('copyMessage');
var body = <String, dynamic>{
'chat_id': chat_id,
'from_chat_id': from_chat_id,
'message_id': message_id,
'caption': caption,
'parse_mode': parse_mode,
'caption_entities':
caption_entities == null ? null : jsonEncode(caption_entities),
'disable_notification': disable_notification,
'reply_to_message_id': reply_to_message_id,
'allow_sending_without_reply': allow_sending_without_reply,
'reply_markup': reply_markup == null ? null : jsonEncode(reply_markup)
};
return MessageId.fromJson(
await HttpClient.httpPost(requestUrl, body: body));
}