正在使用python-telegram-bot
我尝试从聊天中的用户获取voice file
,但我获取的是error
- 错误:**
RuntimeWarning: coroutine 'ExtBot.get_file' was never awaited
return await self.callback(update, context)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
- 这是我的密码**
async def get_voice(update: Update, context: CallbackContext):
# get basic info about the voice note file and prepare it for downloading
new_file = context.bot.get_file(update.message.voice.file_id)
print('new_file')
app = ApplicationBuilder().token(TOKEN).build()
app.add_handler(MessageHandler(filters.VOICE, get_voice))
1条答案
按热度按时间nnsrf1az1#
为了解决这个问题,你需要等待context.bot.get_file