I have a command where I want to write the id from a user in a Voice Channel into an array. So far I managed to write the whole collection of the user with joinedTimestamp
etc. Now I want to extract the ID from the user from the collection. My command looks like this:
client.on('messageCreate', (message) => {
let waitingroom = message.guild.channels.cache.get("952324088762867722")
let player = [];
let isadmin = message.member.roles.cache.has(adminRole);
if (message.content.toLowerCase() === prefix + 'startgame' && isadmin) {
player.push(waitingroom.members);
console.log(player);
}
});
And this is what I get from the array when 2 users are in the waitingroom
:
[
Collection(2) [Map] {
'392776445375545355' => GuildMember {
guild: [Guild],
joinedTimestamp: 1646940658665,
premiumSinceTimestamp: null,
nickname: null,
pending: false,
communicationDisabledUntilTimestamp: null,
_roles: [Array],
user: [User],
avatar: null
},
'849388169614196737' => GuildMember {
guild: [Guild],
joinedTimestamp: 1647168003344,
premiumSinceTimestamp: null,
nickname: 'Test-Account [Nils]',
pending: false,
communicationDisabledUntilTimestamp: null,
_roles: [],
user: [User],
avatar: null
}
}
]
But I only want the ID’s from the users from the collection. I appreciate any help.