Module

x/grammy/context.ts>Context#replyWithVoice

The Telegram Bot Framework.
Very Popular
Go to Latest
method Context.prototype.replyWithVoice
import { Context } from "https://dotland.deno.dev/x/grammy@v1.17.1/context.ts";

Context-aware alias for api.sendVoice. 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.

Parameters

voice: InputFile | string

Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.

optional
other: Other<"sendVoice", "chat_id" | "voice">

Optional remaining parameters, confer the official reference below

optional
signal: AbortSignal

Optional AbortSignal to cancel the request

Official reference: https://core.telegram.org/bots/api#sendvoice