使用 sendPhoto 发送动画 GIF(Telegram 机器人)

Sending animated GIFs with sendPhoto (Telegram bot)

我正在尝试使用 sendPhoto(Telegram 的 Bot API)发送带有此请求的动画 GIF:

https://api.telegram.org/bot<token>/sendPhoto?chat_id=<chat_id>&photo=http://i.giphy.com/13IC4LVeP5NGNi.gif

该方法有效,因为我 ok:true 回来了,但聊天中的图像 window 是移动 GIF 的静态快照。

如何显示 GIF 动画?我应该使用其他方法吗?

您应该使用 sendAnimation 方法发送 GIF 或 H.264/MPEG-4 AVC 无声视频
只需为您的 GIF 文件使用 animation 参数。


sendPhoto仅用于静态图片。

使用sendVideo方法!

https://api.telegram.org/bot<token>/sendVideo?chat_id=<chat_id>&video=http://i.giphy.com/13IC4LVeP5NGNi.gif

这会起作用