πŸ‘¨πŸΌ‍πŸ’»κ°œλ°œ/파이썬

파이썬 - ν…”λ ˆκ·Έλž¨ 봇 파일 μ—…λ‘œλ“œ(봇이 νŒŒμΌμ„ λ‹€μš΄λ‘œλ“œ)

Janger 2022. 6. 18. 04:16
728x90
def uploader(update: Update, context: CallbackContext) -> None:
    try:
        with open(update.message.document.file_name, 'wb') as f:
            context.bot.get_file(update.message.document).download(out=f)

        update.message.reply_text( '파일 μ—…λ‘œλ“œ 성곡.' )

    except:
        update.message.reply_text( '파일 μ—…λ‘œλ“œ μ‹€νŒ¨.' )
        
        

updater.dispatcher.add_handler(MessageHandler(Filters.document, uploader))

 

 

좜처: 

https://stackoverflow.com/questions/62253718/how-can-i-receive-file-in-python-telegram-bot

 

How can I receive file in python-telegram-bot?

I have a problem about file messages in python telegram bot. How can I receive file and read that file ? Or save it.

stackoverflow.com

 

728x90