我的 discord bot 不播放 mp3 文件并且没有给出任何错误
My discord bot doesn't play mp3 file and it gives no errors
我试过调试,但一切正常,然后什么也没有发生
澄清一下filename
是包含文件
的文件路径
async def playing_video(ctx, filename):
global vc
voice_channel = ctx.author.voice.channel
channel = None
# Check if user is in a voice channel
if voice_channel != None:
channel=voice_channel.name
print(f"Voice Channel: {voice_channel}")
vc = await voice_channel.connect()
# It reaches here with the right path to the file and what looks like the right vc but then nothing happens.
vc.play(discord.FFmpegPCMAudio(filename), after=lambda e: print('done', e))
else:
await ctx.send("You must use *join first!")
我只找到一个和我有同样问题的人,但他只是写了“我解决了”,没有说如何。
我觉得自己像个白痴。问题是机器人没有发言权。
我将此搁置,因为我相信有人会这样做。
我试过调试,但一切正常,然后什么也没有发生
澄清一下filename
是包含文件
async def playing_video(ctx, filename):
global vc
voice_channel = ctx.author.voice.channel
channel = None
# Check if user is in a voice channel
if voice_channel != None:
channel=voice_channel.name
print(f"Voice Channel: {voice_channel}")
vc = await voice_channel.connect()
# It reaches here with the right path to the file and what looks like the right vc but then nothing happens.
vc.play(discord.FFmpegPCMAudio(filename), after=lambda e: print('done', e))
else:
await ctx.send("You must use *join first!")
我只找到一个和我有同样问题的人,但他只是写了“我解决了”,没有说如何。
我觉得自己像个白痴。问题是机器人没有发言权。
我将此搁置,因为我相信有人会这样做。