title: Reasons for failure in Discord bot sending DM users
body: <p>So I've written a bot. That's working. I'm not using an existing library, I assembled my own using the API documentation.</p>
  
  <p>I managed to DM myself:</p>
  
  <pre><code>// representative code - real thing uses higher-level functions like Discord::createDM()
  // but for "MCVE" reasons this is just to show the API calls being made.
  $dm = Discord::api("POST", "/users/@me/channels",
      ["recipient_id"=&gt;Discord::KNOWN_USERS['Niet']]
  );
  Discord::api("POST", "/channels/".$dm-&gt;id."/messages",
      ["content"=&gt;"Hello World!"]
  );
  </code></pre>
  
  <p>Works just fine. However, I tried to have it DM someone else, and got a 403 Forbidden error with the message "50007 Cannot send messages to this user"</p>
  
  <p>I would like for the bot to be able to DM guild members, either in response to commands (rather than having a separate <code>#bot-commands</code> channel) or in response to auto-moderation (rather than publicly calling them out, which kind of defeats the purpose of deleting offending messages)</p>
  
  <p>However, if the bot can't send these messages, then that's a bit of a problem.</p>
  
  <p>What are the possible causes of not being able to send messages to a specific user, and how might I go about resolving them?</p>
  
  <p>Or should I just give up and just use a <code>#bot-messages</code> channel?</p>