Discord.py语音随机停止

时间:2018-12-09 23:53:08

标签: python python-asyncio discord.py

我正在尝试使用一些语音命令编写一个不和谐的机器人。其中之一正常工作:

async def padoru(ctx):
    if not bot.is_voice_connected(ctx.message.server):
        vc = await bot.join_voice_channel(ctx.message.author.voice_channel)
    else:
        await vc.move_to(ctx.message.author.voice_channel)
    player = vc.create_ffmpeg_player('padoru.mp3',after=lambda:print("padoru started"))
    player.start()
    while not player.is_done():
        pass
    await vc.disconnect()

当对方使机器人崩溃时(播放歌曲一段时间后):

async def kazoo(ctx):
    if not bot.is_voice_connected(ctx.message.server):
        vc = await bot.join_voice_channel(ctx.message.author.voice_channel)
    else:

        await vc.move_to(ctx.message.author.voice_channel)
    player = vc.create_ffmpeg_player(random.choice(kazoos),after=lambda:print("kazoo started"))
    player.start()
    while not player.is_done():
        pass
    await vc.disconnect()

崩溃并不能真正打印出任何东西,机器人只是停止响应任何命令以及停止语音命令本身。

0 个答案:

没有答案