我构建了一个音乐机器人,但我犯了一个错误。
我得到的错误正是这样;
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Guild' object has no attribute 'voice'
命令;
@Bot.command(pass_context=True)
async def play(ctx, url : str):
voiceChannel = discord.utils.get(ctx.guild.voice.channels, ctx.message.author.voice_channel)
voice = discord.utils.get(Bot.voice_clients, guild)
await voiceChannel.connect()
guild = ctx.guild
答案 0 :(得分:0)
尝试使用这个:
voiceChannel = discord.utils.get(ctx.voice_client,ctx.message.author.voice_channel)