[英]Discord.py - How can I get the amount of all members who are in a voicechannel with my bot?
I have a music bot and I want to know how many people are listening to the music.我有一个音乐机器人,我想知道有多少人在听音乐。 How can I do this?
我怎样才能做到这一点? I searched for like 2 hours and found nothing :/
我搜索了大约 2 个小时,但一无所获:/
What I tried so far:到目前为止我尝试过的:
vc = client.voice_clients
channel = '\n'.join(channels.channel for channels in vc)
discord_listeners = int(channel.members)
Error:错误:
'str' object has no attribute 'members'
if you want to know that try with:如果您想知道,请尝试:
vc = client.voice_clients
for channels in vc:
print(f"the channel {channels.channel.name} has {len(channels.channel.members)} members")
or like this或者像这样
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.