我正在处理移动特定语音通道的随机成员的命令,但是在创建成员列表时,以下代码给出错误“'NoneType'对象没有属性'members'”。如何在特定的语音通道中创建成员列表?
@client.command(aliases=['prison'])
async def move_member(ctx):
voice_channel = discord.utils.get(ctx.guild.channels, id='670006903815929893')
user = random.choice(voice_channel.members)
await client.move_member(user, name='Jail')
答案 0 :(得分:0)
所有discord.py id是整数,而不是字符串:
@client.command(aliases=['prison'])
async def move_member(ctx):
voice_channel = discord.utils.get(ctx.guild.channels, id=670006903815929893)
user = random.choice(voice_channel.members)
jail = discord.utils.get(ctx.guild.channels, name='Jail')
await user.edit(voice_channel=jail)