Node-telegram-bot-api: Specifying file attributes, when sending files using HTTP URL or file_id, not working

Created on 30 Apr 2017  路  11Comments  路  Source: yagop/node-telegram-bot-api

Bug Report

I have read:

I am using the latest version of the library.

Code

const options = {
            title: 'title',
            performer: 'performer'
          };
bot.sendAudio(chatId, url, options)

Expected Behavior

{
  "message_id": ...,
  "from": { ... },
  "chat": { ... },
  "date": ... ,
  "audio": {
    "duration": ...,
    "mime_type": "audio/mpeg",
    "title": "title",
    "performer": "performer",
    "file_id": "...",
    "file_size": ...
  }
}

Actual Behavior

{
  "message_id": ...,
  "from": { ... },
  "chat": { ... },
  "date": ...,
  "audio": {
    "duration": ...,
    "mime_type": "audio/mpeg",
    "file_id": "...",
    "file_size": ...
  }
}

Steps to reproduce the Behavior

As the code written.

question

All 11 comments

So apparently it works depending on the value of the audio parameter (2nd parameter) in TelegramBot#sendAudio(). If I use a local file, it seems to work just fine. But using a HTTP URL does not work. Could you try reproducing my observation?

This is something you should report to Telegram Bot Support. Please keep us updated.

@GochoMugo just like you said.
When second parameter is URL or file_id , the options does not work as expected.
Thanks for replying .

@hufan-Akari Did you contact Bot support?

@GochoMugo Yes, but they think it behaves as intended.

When the audio is a file_id, it means that the audio is already uploaded to Telegram servers, so it is not modified. This cuase that the actual performer and title is taken from the file itself, not from the request.

In case of URL the title and performer is taken from the URL too, not from the actual request.

I'm trying to ask the chance to modify the performer and title when the sent audio is URL .

-- When the audio is file_id, the current behavior is okay, we should not to modify it. But the url is another thing.To modify it, we have to download it and upload it again. Is there any more effective method to do it?

We will take that information when using urls from the Twitter Cards (https://dev.twitter.com/cards/overview) or Open Graph (http://ogp.me/)
If you change them, we should take it from there.

What does it mean ?

We will take that information when using urls from the Twitter Cards (https://dev.twitter.com/cards/overview) or Open Graph (http://ogp.me/)

They retrieve metadata of the object residing at the submitted URL (using the mentioned protocols).

If you change them, we should take it from there

This statement is rather ambiguous. I think they want you to change the metadata at the original URL.

@GochoMugo Sorry for that.
English is not my first language. I didn't make myself understood.

Could you report this issue to Telegram Bot Support ?

Just shot the query their way. Let's wait and see...

The API does not allow one to specify the attributes of the object, if they can be retrieved from the remote source (when using URL) or the file (when using file_id).

Imagine if you could specify the incorrect (read: fabricated) attributes when using URLs. It would open Telegram users to click-bait shenanigans.

The current behavior cannot avoid the _click-bait shenanigans_, you can download the file from remote source and upload to Telegram server if you want to modify it.

The fact is some metadata missed and I need to correct it.
The workaround is just as said before, download and upload. It is not effective.

screenshot

The API should bring convenience to people rather than assume that the developer is evil.

As mentioned earlier, this is a limitation/restriction set by Telegram Bot API itself (not the library).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alikhil picture alikhil  路  3Comments

Lemmmy picture Lemmmy  路  3Comments

Rezania815 picture Rezania815  路  3Comments

jacopocappelli1989 picture jacopocappelli1989  路  4Comments

FerX picture FerX  路  4Comments