sendAudio: Send audio files

View source: R/bot.R

sendAudioR Documentation

Send audio files

Description

Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. For sending voice messages, use the sendVoice method instead.

Usage

sendAudio(
  chat_id,
  audio,
  duration = NULL,
  performer = NULL,
  title = NULL,
  caption = NULL,
  disable_notification = FALSE,
  reply_to_message_id = NULL,
  reply_markup = NULL,
  parse_mode = NULL
)

Arguments

chat_id

Unique identifier for the target chat or username of the target channel.

audio

Audio file to send. Pass a file_id as String to send an audio that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio from the Internet, or upload a local audio file by passing a file path.

duration

(Optional). Duration of sent audio in seconds.

performer

(Optional). Performer.

title

(Optional). Track name.

caption

(Optional). Audio caption, 0-1024 characters.

disable_notification

(Optional). Sends the message silently. Users will receive a notification with no sound.

reply_to_message_id

(Optional). If the message is a reply, ID of the original message.

reply_markup

(Optional). A Reply Markup parameter object, it can be either:

  • ReplyKeyboardMarkup

  • InlineKeyboardMarkup

  • ReplyKeyboardRemove

  • ForceReply

parse_mode

(Optional). Send 'Markdown' or 'HTML', if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.

Details

You can also use it's snake_case equivalent send_audio.

Examples

## Not run: 
bot <- Bot(token = bot_token("RTelegramBot"))
chat_id <- user_id("Me")
audio_url <- "http://www.largesound.com/ashborytour/sound/brobob.mp3"

bot$sendAudio(
  chat_id = chat_id,
  audio = audio_url
)

## End(Not run)

ebeneditos/telegram.bot documentation built on Sept. 12, 2022, 9:20 p.m.