【发布时间】:2021-08-05 03:37:01
【问题描述】:
我目前播放音乐的代码如下:
@bot.command()
async def play(ctx):
if not ctx.voice_client: # checks to make sure bot is not already in voice channel
audio_source = 'my_music.mp3'
voice_channel = ctx.message.author.voice.channel
ffmpeg = r'C:\Users\dmolp\PycharmProjects\DiscordBot\ffmpeg\ffmpeg\bin'
await voice_channel.connect()
voice_client = ctx.voice_client
voice_client.play(discord.FFmpegPCMAudio(executable=ffmpeg, source=audio_source))
问题是每当我运行它并使用 !play 命令时,机器人就可以很好地加入语音频道,但它不播放音乐并且我收到此错误,
discord.ext.commands.errors.CommandInvokeError:命令引发异常:PermissionError:[WinError 5] 访问被拒绝
我完全被这个难住了,感谢任何帮助!
【问题讨论】:
-
你能把完整的追溯吗?
标签: python discord.py