【发布时间】:2022-02-06 14:28:32
【问题描述】:
@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'))
【问题讨论】:
-
机器人是否连接到语音通道?
-
还有为什么你一启动机器人就试图运行这个命令。制作一个单独的命令。