使用sendPhoto(Telegram bot)发送动画GIF

问题描述 投票:0回答:3

我正在尝试使用 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
一样,但聊天窗口中的图像是移动 GIF 的静态快照。

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

telegram telegram-bot php-telegram-bot
3个回答
25
投票

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

animation
参数即可。


sendPhoto
仅用于静态图像。


14
投票

使用sendVideo方法!

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

这会起作用


0
投票

机器人的描述照片,640x360 像素。或者 GIF,320x180、640x360 或 960x540 像素。当人们打开与您的机器人的聊天时,他们会在标题为“这个机器人能做什么?”的块中看到这张照片或 GIF。使用 /empty 删除当前图片。

© www.soinside.com 2019 - 2024. All rights reserved.