sendVoice method
Future<Message>
sendVoice(
- ChatID chatId,
- HttpFile voice, {
- ParseMode? parseMode,
- int? duration,
- bool? disableNotification,
- bool? protectContent,
- int? replyToMessageId,
- bool? allowSendingWithoutReply,
- ReplyMarkup? replyMarkup,
inherited
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.
For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document).
On success, the sent Message
is returned.
Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
Implementation
Future<Message> sendVoice(
ChatID chatId,
HttpFile voice, {
String? caption,
ParseMode? parseMode,
List<MessageEntity>? captionEntities,
int? duration,
bool? disableNotification,
bool? protectContent,
int? replyToMessageId,
bool? allowSendingWithoutReply,
ReplyMarkup? replyMarkup,
}) {
return _client.apiCall(_token, 'sendVoice', {
'chat_id': chatId,
'voice': voice,
'caption': caption,
'parse_mode': parseMode,
'caption_entities': captionEntities,
'duration': duration,
'disable_notification': disableNotification,
'protect_content': protectContent,
'reply_to_message_id': replyToMessageId,
'allow_sending_without_reply': allowSendingWithoutReply,
'reply_markup': replyMarkup,
});
}