sendVoice method

Future<Message> sendVoice(
  1. ChatID chatId,
  2. HttpFile voice, {
  3. String? caption,
  4. ParseMode? parseMode,
  5. List<MessageEntity>? captionEntities,
  6. int? duration,
  7. bool? disableNotification,
  8. bool? protectContent,
  9. int? replyToMessageId,
  10. bool? allowSendingWithoutReply,
  11. 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,
  });
}