如何使漫游器将所有成员移动到另一个语音通道

时间:2019-09-09 12:57:33

标签: python python-3.x discord.py discord.py-rewrite

我在遇到此命令事件时遇到了麻烦。我想播放一种称为options.ogg的声音,该机器人可以加入语音通道并正常播放音频,但是此后会产生错误InvalidArgument: The channel provided must be a voice channel。我尝试阅读它,但是我很难理解它是如何工作的。所以基本上,我希望机器人播放声音,然后将所有成员从加入的语音聊天中移到另一个语音聊天中。

@client.command(pass_context=True)
   async def selfdestruct(ctx):
   author = ctx.message.author
   voice_chat = author.voice_channel
   vc = await client.join_voice_channel(voice_chat)
   channel = '282328034474983425'
  player = vc.create_ffmpeg_player('C:\sound\options.ogg', after=lambda: 
 print('done'))
player.start()
while not player.is_done():
    await asyncio.sleep(1)
# disconnect after the player has finished
player.stop()

await vc.disconnect()
await client.move_member(author, channel)

1 个答案:

答案 0 :(得分:0)

因为答案已在评论中,所以我想我会在事后为任何人做一个正式的人。

基本上,在这个特定问题中,个人尝试使用的方法move_member()在当前文档中不存在。

建议使用member.move_to(),并且他们需要将通道从字符串ID转换为整数ID。

以下行应更改为:

channel = '282328034474983425'

channel = client.get_channel(282328034474983425)

相关问题