0

我正在使用 pyTelegramapiBot (Python) 做电报机器人。它的工作原理是一系列问题并显示一般信息。我想添加上传照片的功能。逻辑:用户输入名字、姓氏、他的照片。他会看到带有照片的一般信息。问题:如何在需要的时候准确地获取用户的照片?否则,什么都不会发生。

4

1 回答 1

0
def addImage(message):
    if not message.photo:
        msg = bot.send_message(message.chat.id, "Add image")
        bot.register_next_step_handler(msg, addImage)
        return
    item = data[message.from_user.id]
    item.photo = message.photo[-1].file_id
    bot.send_photo(message.chat.id, photo=item.photo])
于 2020-05-16T10:07:02.907 回答