【发布时间】:2021-05-01 03:06:59
【问题描述】:
我目前正在编写一个不和谐的机器人,它应该使用命令“!离开”执行 mp3 文件,然后离开频道。不幸的是,机器人离开频道并且不播放 mp3 文件,或者(没有 await 命令)机器人播放 mp3 文件,但不离开频道
@client.command(pass_context=True)
async def leave(ctx):
if ctx.voice_client:
voice = ctx.channel.guild.voice_client
voice.play(discord.FFmpegPCMAudio(r"C:\Users\***\Desktop\DiscordBot\bye.mp3"))
await voice.disconnect()
else:
await ctx.send("test ")
如果有人可以帮助我,我将不胜感激。我没有通过谷歌等找到任何解决方案。
最好的问候 交通标签
【问题讨论】:
标签: python discord.py