I am making a discord chatbot, but something I would like it to do is to join a random voice channel. I have tried the following from a different example, but you need to specify a channel ID. Which doesn’t suit my needs.
const channel = message.guild.channels.get('voiceChannelID');
I've also tried this from Check if a channel is a voice channel but it also requires a specific channel ID.
const channelObject = message.guild.channels.cache.get('channel id here'); // Gets the channel object
if (channelObject.type === 'voice') return; // Checks if the channel type is voice
It would be greatly appreciated if you could answer with some code that would find a random voice channel.