-2
テレグラムボットApiを使用せずにユーザが送信した写真を、テレグラムボットでどのようにダウンロードできますか? (イムpyTelegramBotAPIを使用して)テレグラムなしで写真をダウンロードする
テレグラムボットApiを使用せずにユーザが送信した写真を、テレグラムボットでどのようにダウンロードできますか? (イムpyTelegramBotAPIを使用して)テレグラムなしで写真をダウンロードする
あなたが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)
を