title: How to check if a message author has a role?
body: <p>I am trying to code a bot for a game idea my friends and I have. The command I'm working on is the score adjuster. Obviously though, I only want moderators to have access to this command.</p>
  <p>I have read several threads and tried several methods to check for a role though, and all close the script with this error:</p>
  <pre><code>if (message.member.roles.has(modRole))                  
  </code></pre>
  <blockquote>
  <p>TypeError: Cannot read properties of null (reading 'roles')</p>
  </blockquote>
  <p>This is the last code I tried:</p>
  <pre class="lang-js prettyprint-override"><code>bot.on(&quot;message&quot;, (message) =&gt; {
      let args = message.content.toLowerCase().substring(PREFIX.length).split(&quot; &quot;);
  
      if (args[0] === &quot;adjust&quot; &amp;&amp; args[1] !== &quot;help&quot;) {
          if (message.member.roles.has(&quot;modRoleID&quot;)) {
              // Adjust command here
          }
      }
  });
  </code></pre>
  <p>Why is the bot not able to read .roles()?</p>