eternnoir / pyTelegramBotAPI

Python Telegram bot api.
GNU General Public License v2.0
8.11k stars 2.03k forks source link

How can I get voice messages in AsyncTeleBot? #2304

Closed prp-e closed 5 months ago

prp-e commented 5 months ago

Please answer these questions before submitting your issue. Thanks!

  1. What version of pyTelegramBotAPI are you using?

4.19.0

  1. What OS are you using?

Ubuntu 22.04

  1. What version of python are you using? 3.12

This is my code:

@bot.message_handler(content_types=['voice'])
async def voice_processing(message):
    file_info = bot.get_file(message.voice.file_id)
    file_info.wait()
    downloaded_file = bot.download_file(file_info.file_id)

and it says there is no method wait() for this coroutine. What can I do?

coder2020official commented 5 months ago

Learn async await principles