title: discord.js v12 Unban Command
body: <p>I made a unban command using discord.js v12. I keep getting the same error every time I run it saying DISCORD API ERROR: NOT FOUND. Even though I send a correct user ID or mention</p>
  <pre><code> const Discord = require(&quot;discord.js&quot;);
      module.exports = {
        name: &quot;unban&quot;,
        category: &quot;moderation&quot;,
        description: &quot;unban&quot;,
        run: async (client, message, args) =&gt; {
      
      
      
          let unbanned = message.mentions.users.first() || client.users.resolve(args[0]);
          let reason = args.slice(1).join(&quot; &quot;);
      
          let member = await client.users.fetch(unbanned);
          let ban = await message.guild.fetchBans();
      
      // MESSAGES
  
      if (!unbanned) {
        let unbaninfoembed = new Discord.MessageEmbed()
          .setTitle(&quot;Command: unban&quot;)
          .setDescription(
            `**Description:** Unban a member. \n` +
              &quot;**Sub Commands:**\n&quot; +
              &quot;&quot; +
              &quot;**Usage:**\n&quot; +
              &quot;-unban [user] (limit) (reason) \n&quot; +
              &quot;**Examples:** \n&quot; +
              &quot;-unban &lt;@597253939469221891&gt; good guy \n&quot; +
              &quot;-unban 597253939469221891 good guy &quot;
          )
          .setColor(&quot;#2C2F33&quot;);
        message.channel.send(unbaninfoembed);
  
        return;
      }
  
      if (!ban.get(member.id)) {
        let notbannedembed = new Discord.MessageEmbed()
          .setDescription(&quot;This user is not banned&quot;)
          .setColor(&quot;#2C2F33&quot;);
        message.channel.send(notbannedembed);
  
        return;
      }
  
      if (!message.guild.me.permissions.has(&quot;BAN_MEMBERS&quot;)) {
        let botnoperms = new Discord.MessageEmbed()
          .setDescription(
            &quot;I do not have permissions, please contact an administrator&quot;
          )
          .setColor(&quot;#2C2F33&quot;);
        message.channel.send(botnoperms);
  
        return;
      }
  
      if (!message.member.permissions.has(&quot;BAN_MEMBERS&quot;)) {
        let nopermsembed = new Discord.MessageEmbed()
          .setDescription(
            &quot;You do not have permission `BAN MEMBERS` contact an administrator&quot;
          )
          .setColor(&quot;#2C2F33&quot;);
        message.channel.send(nopermsembed);
  
        return;
      }
  
      var user = ban.get(member.id);
      message.guild.members.unban(member);
      let successfullyembed = new Discord.MessageEmbed()
        .setTitle(`${member.tag} has been successfully unbanned.`)
        .setColor(&quot;#2C2F33&quot;);
  
      message.channel.send(successfullyembed);
    },
  };
  </code></pre>
  <p>I get this error whenever I run the command:</p>
  <pre><code>(node:106) UnhandledPromiseRejectionWarning: DiscordAPIError: 404: Not Found
      at RequestHandler.execute (/home/runner/bot/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
  (node:106) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
  (node:106) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  </code></pre>
  <p>Can you help me out? Thanks in advance. This command also only unbans users in the server and not outside it. Is there any way to fix this out?</p>