Sending animated GIFs with sendPhoto (Telegram bot)

*爱你&永不变心* 提交于 2020-08-24 06:51:42

问题


I'm trying to send an animated GIF with sendPhoto (Telegram's Bot API) with this request:

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

That method works, as in, I get ok:true back, but the image in the chat window is a still snapshot of the moving GIF.

How can I get the animated GIF to show? Is there another method I should use?


回答1:


You should use the sendAnimation method for sending a GIF or H.264/MPEG-4 AVC video without sound.
Just use the animation parameter for your GIF file.


sendPhoto is only used for static images.




回答2:


use sendVideo method!

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

this will work



来源:https://stackoverflow.com/questions/41171347/sending-animated-gifs-with-sendphoto-telegram-bot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!