下载Image Python Telegram API

时间:2017-05-11 10:28:48

标签: python telegram python-telegram-bot

我按照他们关于下载图像的简短教程,但我遇到了一个例外:

telegram.photosize.PhotoSize object at ... is not JSON serializable

捕捉图像的功能如下:

def photo(bot, update):
    file_id = update.message.photo[-1]
    newFile = bot.getFile(file_id)
    newFile.download('test.jpg')
    bot.sendMessage(chat_id=update.message.chat_id, text="download succesfull")

photo_handler = MessageHandler(Filters.photo, photo)
dispatcher.add_handler(photo_handler)

此时我不知道我做错了什么,在网上找不到任何解决方案。

0 个答案:

没有答案