sendMediaGroup method
Future<List<Message> >
sendMediaGroup(
- dynamic chat_id,
- List<
InputMedia> media, { - bool? disable_notification,
- int? reply_to_message_id,
- bool? allow_sending_without_reply,
inherited
Use this method to send a group of photos or videos as an album
On success, an array of the sent Message
s is returned.
Implementation
Future<List<Message>> sendMediaGroup(dynamic chat_id, List<InputMedia> media,
{bool? disable_notification,
int? reply_to_message_id,
bool? allow_sending_without_reply}) 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('sendMediaGroup');
var body = <String, dynamic>{
'chat_id': chat_id,
'media': jsonEncode(media),
'disable_notification': disable_notification,
'reply_to_message_id': reply_to_message_id,
'allow_sending_without_reply': allow_sending_without_reply,
};
return (await HttpClient.httpPost(requestUrl, body: body))
.map<Message>((message) => Message.fromJson(message))
.toList();
}