为什么电报机器人中的文件 ID 在几天后不起作用?

Why the file id, in telegram bot, not work after some days?

我正在使用电报 API 并创建 php 电报机器人。要使用 sendVideo 方法发送视频文件,请像 BAADBAADbwADhd7gCEpUooz4V5Q1Ag 一样使用 file_id。但是过了几天这个 file_id 没有用,我不得不再次上传这个视频文件。有什么问题?

正如您在 this link 中所读:

Can I count on file_ids to be persistent?

For the moment, file_ids for your bot's outgoing files may be recycled after several thousand files have been sent. This may be changed in the future. Inbound file_ids can be treated as persistent.

因此,如果您将文件从您的服务器发送到电报用户(通过机器人),返回的 file_id 不能是永久的。您可以将文件从用户转发到机器人并保存 file_id 而不是那样。