简体   繁体   中英

How to get users id form voice channel

How can I get the ID of the users on the voice channel?

More specific Can I check the number of people and their id's on the voice channel that also has the bot?

The VoiceChannel class has a property called members (Type: Collection ), which contains all members in a VoiceChannel .

As an example, you can use Collection#map to map each member by 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.size;
// --> 25 (Integer)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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