简体   繁体   English

通过电报的bot API发送照片

[英]Sending photo via telegram's bot api

I am using telegram bot api (python) and trying to send photo via link, but getting an error: 我正在使用电报bot api(python)并尝试通过链接发送照片,但出现错误:

def model(bot, update):
   pic = 'http://pi.lmcdn.ru/img600x866/T/O/TO263AMZGP37_5925451_1_v2.jpg'
   bot.send_photo(chat_id=update.message.chat_id, photo = pic)

and I get this error 我得到这个错误

"Wrong file identifier/http url specified"

Has anyone ever encountered such a problem? 有没有人遇到过这样的问题? The link is okay, but it can't be sent as photo. 链接可以,但是不能作为照片发送。 Btw this works well with another links. 顺便说一句,这与另一个链接很好地工作。

I got this! 我懂了! The documentation says 该文件说

Sending by URL 通过URL发送

Other configurations may work but we can't guarantee that they will. 其他配置可能会起作用,但我们不能保证一定会。

as it was said by other user: "you should send your photos using file_id or multipart/form-data." 正如其他用户所说:“您应该使用file_id或multipart / form-data发送照片。”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM