机器人不播放音乐

Bot doesn't play music

@client.event
async def on_ready(pass_context = True):
    print('logged in as {0.user}'.format(client))
    me = client.get_user(str(308330919176175616))
    tchannel = client.get_channel(931274904228233291)
    vchannel = client.get_channel(939513894001578024)
    await vchannel.connect()
    await vchannel.play(discord.FFmpegPCMAudio['музика.mp3'], pass_context = True)

AttributeError: 'VoiceChannel' 对象没有属性 'play'

更新: 我已经更改了代码,所以它没有向我显示错误,但是仍然没有音乐。 代码:

@client.event
async def on_ready(pass_context = True):
    print('logged in as {0.user}'.format(client))
    me = client.get_user(str(308330919176175616))
    tchannel = client.get_channel(931274904228233291)
    vchannel = client.get_channel(939513894001578024)
    vc = await vchannel.connect()
    vc.play(discord.FFmpegPCMAudio('s.mp3'))

试试这个代码,而不是在手之前提到语音通道让机器人找到它!我有这个有效的代码。所以试试这个!

@client.command()
async def play(ctx):
    voice_state = ctx.author.voice

    if voice_state == None:
        #user isnt in voice channel so it wont connect
        return

    if voice_state != None:
        await ctx.author.voice.channel.connect()

    vc = ctx.voice_client
    vc.play(discord.FFmpegPCMAudio('s.mp3'))