嗨,我正在尝试获取语音通道及其名称,但是我遇到了属性错误AttributeError: 'NoneType' object has no attribute 'channel'
在await ctx.send(f':white_check_mark: {member.name} was kicked from voice channel: **{member.voice.channel.name}**.')
我不确定是什么导致了此问题:
这是我的代码:
async def voicekick(self, ctx, member: discord.Member):
"""Kicks a member from voice and restricts them from joining all voice channels.
- member: The member to kick
"""
vcr = get(ctx.guild.roles, name="VC Restricted")
if member.voice is None:
await ctx.send("Member not in VC")
else:
await member.move_to(channel=None, reason=None)
await member.add_roles(vcr)
await ctx.send(f':white_check_mark: {member.name} was kicked from voice channel: **{member.voice.channel.name}**.')
帮助表示赞赏。