1

Im making a suggestion system but when you set the suggestion channel to a voice channel and make a suggestion the whole script errors.So i want to know if theres a way to tell the diffrence between a text channel and voice channel so if its a voice channel then i wanna return. But i dont know how to check if a channel is a voice or text channel.

Og Gamer
  • 21
  • 1
  • 2

1 Answers1

1

We can use the Channel.type object to determine whether it is a voice channel or not.

First, we want to get the channel, using either the .get() or .find() functions, and then check the channel's type using a simple if statement:

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
Xeoth
  • 1,285
  • 1
  • 11
  • 22
Itamar S
  • 1,555
  • 1
  • 6
  • 15