【问题标题】:How can I make bot reply to an audio message?如何让机器人回复音频消息?
【发布时间】:2021-11-19 03:01:00
【问题描述】:

如何让 aiogram bot 回复音频消息? 我已经尝试过了:

if message.Audio.duration <= 60:
    await message.reply("message")

【问题讨论】:

    标签: python bots telegram aiogram


    【解决方案1】:
    @dp.message_handler(content_types=types.ContentTypes.VOICE | types.ContentTypes.AUDIO)
    async def audio_message_handler(msg: types.Message):
        if msg.content_type == "voice":
            await msg.reply("Voice message")
        elif msg.content_type == "audio":
            await msg.reply("Audio message")
    

    【讨论】:

      猜你喜欢
      • 2021-06-26
      • 1970-01-01
      • 2021-03-05
      • 1970-01-01
      • 2021-07-19
      • 1970-01-01
      • 1970-01-01
      • 2017-07-10
      • 1970-01-01
      相关资源
      最近更新 更多