[英]How I can get channel members (Discord.py)
I need to get Only users of my channel , but I have not found a function that returns the desired result.我需要Only users of my channel ,但我没有找到返回所需结果的 function 。 There is a function to get all users of the bot:
get_all_members()
, but she's not doing exactly what I need.有一个 function 可以获取机器人的所有用户:
get_all_members()
,但她并没有完全满足我的需要。 I want get user nicknames.我想获取用户昵称。 Help me find a solution to my problem.
帮助我找到解决问题的方法。
maybe you can try也许你可以试试
client.users
as in如在
for i in range(len(client.users)):
print(client.users[i].name)
Hope it helps cheers.希望它有助于欢呼。
Hm... I had this issue in a bot I was making a while ago...嗯......我在不久前制作的机器人中遇到了这个问题......
Assuming you want people in the voice channel you are currently in, here is the code to get the users for the voice channel...假设你想要你当前所在的语音通道中的人,这里是获取语音通道用户的代码......
def foo(ctx):
voice_channel_list = ctx.guild.voice_channels
for voice_channels in voice_channel_list:
for member in voice_channels.members:
This will give you all the member objects of the voice channel ctx.author
is currently in. I hope this is what you are looking for.这将为您提供语音通道
ctx.author
当前所在的所有成员对象。我希望这就是您要找的。 If not, let me know and I'll change my answer (if I know the answer).如果没有,请告诉我,我会更改我的答案(如果我知道答案)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.