add_profile_audio()¶
- Client.add_profile_audio()¶
Adds an audio file to the beginning of the profile audio files of the current user.
Usable by Users Bots
- Parameters:¶
audio (``str`` | ``BinaryIO``) – Audio file to add. Pass a file_id as string to add an audio file that exists on the Telegram servers, pass a file path as string to upload a new audio file that exists on your local machine, or pass a binary file-like object with its attribute “.name” set for in-memory uploads.
- Returns:¶
``bool`` | ``None`` (On success, True is returned, otherwise, in)
case the upload is deliberately stopped with
stop_transmission(), None is returned.
Example
# Add audio file by uploading from file await app.add_profile_audio("audio.mp3") # Set audio metadata await app.add_profile_audio( "audio.mp3", title="Title", performer="Performer", duration=234) # Keep track of the progress while uploading async def progress(current, total): print(f"{current * 100 / total:.1f}%") await app.add_profile_audio("audio.mp3", progress=progress)