我找到了这个帖子:How do I make my discord.py bot play mp3 in voice channel?
但不幸的是它已经过时并且不再起作用了。 我的代码:
user = message.author
voice_channel = user.voice.voice_channel
channel = None
if voice_channel != None:
channel=voice_channel.name
await channel.send('User is in channel: '+ channel)
vc = await channel.join(channel)
player = vc.create_ffmpeg_player('Gdzie-ona-jest_.mp3', after=lambda: print('done'))
player.start()
while not player.is_done():
await asyncio.sleep(1)
player.stop()
await vc.disconnect()
else:
await channel.send('User is not in a channel.')
希望你能帮助我,干杯!!