yukashima huksay
yukashima huksay

Reputation: 6238

How to download an mp3 file with telegram bots

I'm using this telegram java api to develop a bot that will change the artist and title tag of the mp3 files you send to it. I tried:

SendAudio msg = new SendAudio()
        .setChatId(update.getMessage().getChatId())
        .setAudio(update.getMessage().getAudio().getFileId())
        .setCaption(caption)
        .setTitle("title")
        .setPerformer("per");

The caption worked but the tags didn't change (I actually don't care about the actual tags of the mp3 files. I care about how it looks on telegram like (title - artist) and I thought it would look how I want it to if Ii change the tags.) so now I want to download the file and manually change the file tags with this library on my local computer and then upload it again to telegram servers. But I can't find any way to do so. is it actually possible?

Upvotes: 1

Views: 1641

Answers (1)

J Johnson
J Johnson

Reputation: 145

When anyone in chat or your bot send a file (mp3, video or file) you receive a JSON with file_id field, if you see at Telegram Bot API you can see a method named getFile where you can download the file what you want using the file_id.

Upvotes: 1

Related Questions