2016-05-15 83 views

回答

1

如果您正在使用pyTelegramBotAPI您可以使用此代碼:

@bot.message_handler(content_types=['photo']) 
def handle_photo(message): 
    raw = message.photo[2].file_id 
    name = raw+".jpg" 
    file_info = bot.get_file(raw) 
    downloaded_file = bot.download_file(file_info.file_path) 
    with open(name,'wb') as new_file: 
     new_file.write(downloaded_file)