简体   繁体   English

如何从语音通道获取用户 ID

[英]How to get users id form voice channel

How can I get the ID of the users on the voice channel?如何获取语音通道用户的ID?

More specific Can I check the number of people and their id's on the voice channel that also has the bot?更具体的我可以在也有机器人的语音通道上检查人数和他们的 id 吗?

The VoiceChannel class has a property called members (Type: Collection ), which contains all members in a VoiceChannel .VoiceChannel类有一个称为members (类型: Collection )的属性,它包含VoiceChannel中的所有成员。

As an example, you can use Collection#map to map each member by ID.例如,您可以使用Collection#map按 ID 映射每个成员。

<VoiceChannel>.members.map(member => member.id);
// --> ["1234567890123456", "1234567890123456", "1234567890123456"] etc (Array)

Since VoiceChannel#members is a Collection , you can use size to get how many items are in the aforementioned Collection .由于VoiceChannel#members是一个Collection ,您可以使用size来获取上述Collection

<VoiceChannel>.members.size;
// --> 25 (Integer)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM