Skip to main content

InputMediaAudio

Represents an audio file to be treated as music to be sent.

📝 Schema

FieldTypeDescription
typestringType of the result, must be audio
mediastringFile to send. Pass a file_id to send a file that exists on the Bale servers (recommended), pass an HTTP URL for Bale to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name.
thumbnailstringOptional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>.
captionInputFile, stringOptional. Caption of the audio to be sent, 0-1024 characters after entities parsing
durationIntegerOptional. Duration of the audio in seconds
titlestringOptional. Title of the audio

⚙️ Get methods

getType()

Retrieves the type of the media, which should always return "audio".

$type = $inputMediaAudioObject->getType();

getMedia()

Retrieves the media file (either file_id, HTTP URL, or attach reference) to be sent.

$media = $inputMediaAudioObject->getMedia();

getThumbnail()

Retrieves the thumbnail of the audio file. This will either be a file_id, HTTP URL, or attach reference if uploaded using multipart/form-data.

$thumbnail = $inputMediaAudioObject->getThumbnail();

getCaption()

Retrieves the caption of the audio to be sent. It returns a string value (0-1024 characters).

$caption = $inputMediaAudioObject->getCaption();

getDuration()

Retrieves the duration of the audio file in seconds.

$duration = $inputMediaAudioObject->getDuration();

getTitle()

Retrieves the title of the audio file.

$title = $inputMediaAudioObject->getTitle();

➕ More

tip

For further information, refer to the official Bale documentation for more details.