title: Problem with Broadcast Dispatcher .resume() function Discord JS v12
body: <p>I am coding a music bot in Discord JS v12 and am currently working on the !pause and !resume commands. They're quite simple, and the code has no errors. This is what happens:</p>
  <ol>
  <li><p>Song is playing.</p>
  </li>
  <li><p>!pause invoked and song pause and the pause confirmationn message is displayed.</p>
  </li>
  <li><p>!resume invoked and the resume confirmation message is displayed.</p>
  </li>
  <li><p>Song does not resume, everything else works perfectly, !queue, !play commands as well.</p>
  <p>This is my <strong>!pause</strong> command code:</p>
  </li>
  </ol>
  <pre><code>// Discord.js initialization.
  const Discord = require(&quot;discord.js&quot;);
  
  // Functions initialization.
  const functions = require(&quot;../../functions.js&quot;);
  
  // Initialization of the server specific variables data.
  const serverData = require(&quot;../../serverData.json&quot;);
  
  // The command's code goes inside an async function.
  module.exports.run = async (bot, message, args, ops) =&gt; {
  
      /****************************/
      /****  MESSAGE DELETION  ****/
      /****************************/
  
      // Deletes the command invocation.
      await message.delete().catch(O_o =&gt; { });
  
      /************************/
      /****  CONDITIONALS  ****/
      /************************/
  
      // Fetches the guild object from the Map.
      let fetched = ops.active.get(message.guild.id);
  
      // Checks if there is any object in the fetched.
      if (!fetched) {
  
          // End of the function and message prints
          return message.channel.send(`&gt; ${message.author}, there is no music playing or queued.`).then(msg =&gt; msg.delete({ timeout: 3000 }));
      }
  
      // Checks if the message author is in the same voice channel as the bot.
      if (message.member.voice.channel !== message.guild.me.voice.channel) {
  
          // End of the function and message prints.
          return message.channel.send(`&gt; ${message.author}, you must be in the same voice channel as the bot.`).then(msg =&gt; msg.delete({ timeout: 3000 }));
      }
  
      // Then, check if the dispatcher is already paused.
      if(fetched.dispatcher.paused){
  
          // End of the function and message prints.
          return message.channel.send(`&gt; ${message.author}, the song is already paused.`).then(msg =&gt; msg.delete({ timeout: 3000 }));
      }
  
      /*****************************/
      /****  COMMAND EXECUTION  ****/
      /*****************************/
  
      // If nothing made the command exit, it executes the pause.
      fetched.dispatcher.pause(true);
  
      // Otherwise tell them in chat that they added a vote to skip.
      message.channel.send(`&gt; ${message.member}, the current song has been paused.`).then(msg =&gt; msg.delete({ timeout: 4000 }));
  }
  
  // Command name.
  module.exports.help = {
      name: &quot;pause&quot;
  }
  </code></pre>
  <p>This is my <strong>!resume</strong> command code:</p>
  <pre><code>// Discord.js initialization.
  const Discord = require(&quot;discord.js&quot;);
  
  // Functions initialization.
  const functions = require(&quot;../../functions.js&quot;);
  
  // Initialization of the server specific variables data.
  const serverData = require(&quot;../../serverData.json&quot;);
  
  // The command's code goes inside an async function.
  module.exports.run = async (bot, message, args, ops) =&gt; {
  
      /****************************/
      /****  MESSAGE DELETION  ****/
      /****************************/
  
      // Deletes the command invocation.
      await message.delete().catch(O_o =&gt; { });
  
      /************************/
      /****  CONDITIONALS  ****/
      /************************/
  
      // Fetches the guild object from the Map.
      let fetched = ops.active.get(message.guild.id);
  
      // Checks if there is any object in the fetched.
      if (!fetched) {
  
          // End of the function and message prints
          return message.channel.send(`&gt; ${message.author}, there is no music playing or queued.`).then(msg =&gt; msg.delete({ timeout: 3000 }));
      }
  
      // Checks if the message author is in the same voice channel as the bot.
      if (message.member.voice.channel !== message.guild.me.voice.channel) {
  
          // End of the function and message prints.
          return message.channel.send(`&gt; ${message.author}, you must be in the same voice channel as the bot.`).then(msg =&gt; msg.delete({ timeout: 3000 }));
      }
  
      // Then, check if the dispatcher is already paused.
      if(!fetched.dispatcher.paused){
  
          // End of the function and message prints.
          return message.channel.send(`&gt; ${message.author}, the song is not paused.`).then(msg =&gt; msg.delete({ timeout: 3000 }));
      }
  
      /*****************************/
      /****  COMMAND EXECUTION  ****/
      /*****************************/
  
      // If nothing made the command exit, it executes the pause.
      fetched.dispatcher.resume(true);
  
      // Otherwise tell them in chat that they added a vote to skip.
      message.channel.send(`&gt; ${message.member}, the current song has been resumed.`).then(msg =&gt; msg.delete({ timeout: 4000 }));
  }
  
  // Command name.
  module.exports.help = {
      name: &quot;resume&quot;
  }
  </code></pre>
  <p>What I have noticed is that if I modify the <strong>resume</strong> command and remove the last if sentence checking if the song is already paused, and if I also add a .pause() before the .resume() and another extra .resume() and follow the same steps, it works:</p>
  <ol>
  <li>Song is playing.</li>
  <li>!pause invoked and song pause and the pause confirmationn message is displayed.</li>
  <li>!resume invoked and the resume confirmation message is displayed.</li>
  <li>!resume invoked a second time and the song resumes with barely any sound glitches, also sends a resume confirmation message on the chat.</li>
  <li>!pause invoked and song pauses and sends the pause confirmation message.</li>
  <li>!resume invoked only one time and the song resumes with barely any sound glitches, also sends a resume confirmation message on the chat.</li>
  <li>From now on the commands work okay.</li>
  </ol>
  <p>This is the <strong>modified !resume</strong> command code:</p>
  <pre><code>// Discord.js initialization.
  const Discord = require(&quot;discord.js&quot;);
  
  // Functions initialization.
  const functions = require(&quot;../../functions.js&quot;);
  
  // Initialization of the server specific variables data.
  const serverData = require(&quot;../../serverData.json&quot;);
  
  // The command's code goes inside an async function.
  module.exports.run = async (bot, message, args, ops) =&gt; {
  
      /****************************/
      /****  MESSAGE DELETION  ****/
      /****************************/
  
      // Deletes the command invocation.
      await message.delete().catch(O_o =&gt; { });
  
      /************************/
      /****  CONDITIONALS  ****/
      /************************/
  
      // Fetches the guild object from the Map.
      let fetched = ops.active.get(message.guild.id);
  
      // Checks if there is any object in the fetched.
      if (!fetched) {
  
          // End of the function and message prints
          return message.channel.send(`&gt; ${message.author}, there is no music playing or queued.`).then(msg =&gt; msg.delete({ timeout: 3000 }));
      }
  
      // Checks if the message author is in the same voice channel as the bot.
      if (message.member.voice.channel !== message.guild.me.voice.channel) {
  
          // End of the function and message prints.
          return message.channel.send(`&gt; ${message.author}, you must be in the same voice channel as the bot.`).then(msg =&gt; msg.delete({ timeout: 3000 }));
      }
  
      /*****************************/
      /****  COMMAND EXECUTION  ****/
      /*****************************/
  
      // If nothing made the command exit, it executes the pause.
      fetched.dispatcher.pause(true);
      fetched.dispatcher.resume();
      fetched.dispatcher.resume();
      
  
      // Otherwise tell them in chat that they added a vote to skip.
      message.channel.send(`&gt; ${message.member}, the current song has been resumed.`).then(msg =&gt; msg.delete({ timeout: 4000 }));
  }
  
  // Command name.
  module.exports.help = {
      name: &quot;resume&quot;
  }
  </code></pre>
  <p>I know this is a bit weird and haven't seen much info on it but I have seen many people that have the same error. I checked <strong>fetched</strong> and it's good, so I don't know what the problem is. I would 110% appreciate your help here, guys.</p>