我在遇到此命令事件时遇到了麻烦。我想播放一种称为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)
答案 0 :(得分:0)
因为答案已在评论中,所以我想我会在事后为任何人做一个正式的人。
基本上,在这个特定问题中,个人尝试使用的方法move_member()
在当前文档中不存在。
建议使用member.move_to()
,并且他们需要将通道从字符串ID转换为整数ID。
以下行应更改为:
channel = '282328034474983425'
到
channel = client.get_channel(282328034474983425)