缺少 1 个必需的位置参数:"源",试图让 Discord 机器人播放暂停的音频



获取

raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: VoiceClient.play() missing 1 required positional argument: ' source'

不明白我做错了什么

这是代码

@client.command(pass_contect = True)
async def resume(ctx):
voice = discord.utils.get(client.voice_clients, guild = ctx.guild)
if voice.is_paused():
voice.play()
await ctx.send("Audio has been paused")
else:
await ctx.send("no audio is playing.")

暂停代码工作没有任何问题

@client.command(pass_contect = True)
async def pause(ctx):
voice = discord.utils.get(client.voice_clients, guild = ctx.guild)
if voice.is_playing():
voice.pause()
else:
await ctx.send("no audio is playing.")

正试图让discordbot恢复播放暂停的音频

您需要告诉我们您使用的库,假设您使用的是Wavelink,则需要使用voice.resume()而不是不带参数的voice.play()

如果您没有使用Wavelink,请参阅正确的文档。

相关内容

最新更新