电报机器人 api:Send_message_media_invalid

Telegram bot api: Send_message_media_invalid

我的 Telegram 机器人内联工作并发送不同类型的文件。我为此使用 InlineQueryResultCachedDocument。大多数时候它工作正常,但如果我尝试发送 *.html 个文件,它会丢弃

BadRequest: Send_message_media_invalid

为什么会这样?


我的要求:

{
  'inline_query_id': '<QUERY_ID>', 
  'results': '[
    {
      "id": "<RESULT ID>", 
      "title": "text", 
      "document_file_id": "<FILE ID>", 
      "description": "", 
      "caption": "", 
      "parse_mode": "html", 
      "type": "document"
    }
  ]', 
'cache_time': 1, 
'is_personal': True
}

我的回复:

{
  "ok":false,
  "error_code":400,
  "description":"Bad Request: SEND_MESSAGE_MEDIA_INVALID"
}

是否有禁止文件列表?

仅支持 .PDF.ZIP 个文件。

documentation 说:

InlineQueryResultDocument

Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.