How could I add the current size of voice channel connections to my /info command? I tried using console.log and logging client.voice.adapters, but still didn't manage to figure it out.
I know that this is a simple question, but maybe answers from you guys will help others, thanks!
I didn't manage to find an answer to my question, but I came up with a solution. I found a way that works for me and is easier than looking for code chunks or asking questions.
What did I do / how to?
new Map();<Map>.set and <Map>.delete to add and remove a number.else if(newState.status === "idle") { 4th step } to check if the new state status is equal to Idle.<Map>.delete(interaction.guild.name, <numberToRemove>); function into 3th step function to remove one number from the map.Copy and Paste if you are too lazy:
Function for adding a number to map should look like this:
<MapName>.set(interaction.guild.name, <numberToAdd>);
Function for deleting a number from map looks like this:<MapName>.delete(interaction.guild.name, <numberToRemove>);
client.voice.adapters maps guild ids to voice adapters. It returns a Map and Maps have a size property that returns the number of elements in that Map.
Would this work?
client.voice.adapters.size