title: How to check if members having a particular role are present in a particular voice channel in discord.js
body: <p>I'm trying to find if any member having a particular role id is present in a particular <strong>voice channel</strong>. If even 1 member having the particular role id is present in that particular voice channel, then only those members can use the commands of music bot.
  From my research, I have came to know that <code>voiceStateUpdate</code> may help but the problem is I don't know how to use it in my codes(cause I am new to JavaScript). Here is the link to the documentation:
  <a href="https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-voiceStateUpdate" rel="nofollow noreferrer">https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-voiceStateUpdate</a> .
  Here is a part of my code:</p>
  <pre><code>client.on('voiceStateUpdate', (oldMember, newMember) =&gt; {
    });
  client.on('message', async message =&gt; {
      if (message.author.bot) return
      if (!message.content.startsWith(prefix)) return
  
      let messageArray = message.content.split(&quot; &quot;);
      let cmd = messageArray[0];
      const args = message.content.substring(prefix.length).split(' ');
      const searchString = args.slice(1).join(' ')
      const url = args[1] ? args[1].replace(/&lt;(._)&gt;/g, '$1') : ''
      const serverQueue = queue.get(message.guild.id)
     
   if() {        //the conditional statement I am trying to put here but I don't know how to do it properly
      if (message.content.startsWith(`${prefix}play`)) {
          const voiceChannel = message.member.voice.channel
          if (!voiceChannel) return message.channel.send(&quot;You need to be in a voice channel to play music&quot;)
      .......
  </code></pre>
  <p>So the main thing is that I don't know what to write their exactly in the if statement that would make my code work properly.</p>