我有这段用于播放音频的代码
player = voice_client.create_ffmpeg_player(audioPath)
players[server.id] = player
player.start()
asyncio.ensure_future(stopPlayer(player,voice_client))
然后是循环函数
async def stopPlayer(player, voice_client):
i=1
while i == 1:
time.sleep(1)
if player.is_playing() == False:
i = 2
await voice_client.disconnect()
但是当音频开始并且我键入命令时,直到音频播放完毕并关闭循环,它才会给出任何输出。