title: TypeError: Cannot read properties of null (reading 'play')
body: <p>I am trying to create a discord bot for the first time in my life so I would like to say that my code is far from being perfect and optimized ^^ '</p>
  <p>I have a problem, <code>TypeError: Cannot read properties of null (reading 'play').</code></p>
  <p>The problem occurs when I try the &quot;skip&quot; command. Everything works fine but when I try the command I have absolutely nothing in my debugging console and only an error on discord returned by the bot.</p>
  <p><strong>Play command:</strong></p>
  <pre><code>const { VoiceConnection } = require(&quot;discord.js&quot;);
  const { Command, CommandoMessage } = require(&quot;discord.js-commando&quot;);
  const ytdl = require('ytdl-core-discord');
  const {UserNotInVoiceChannel } = require(`../../strings.json`);
  
  module.exports = class PlayCommand extends Command {
      constructor(client) {
          super(client, {
              name: `play`,
              aliases: [`p`],
              group: `music`,
              memberName: `play`,
              description: `Lit une video youtube`,
              args: [
                  {
                      key: `query`,
                      prompt: `Quelle musique veux tu lire?`,
                      type: `string`
                  }
              ]
          });
      }
  
      /**
       * 
       * @param {CommandoMessage} message 
       * @param {String} query 
       */
      async run(message, { query }) {
          const server = message.client.server;
  
          if(!message.member.voice.channel){
              return message.say(UserNotInVoiceChannel);
          }
          
          await message.member.voice.channel.join().then((connection) =&gt; {
              if (server.currentVideo.url != &quot;&quot;) {
                  server.queue.push({ title: &quot;&quot;, url: query });
                  return message.say(&quot;Ajouté a la file d'attente&quot;)
              }
  
              server.currentVideo = { title: &quot;&quot;, url: query };
              this.runVideo(message, connection, query);
          });
      }
  
      /**
       * 
       * @param {*} message 
       * @param {VoiceConnection} connection 
       * @param {*} video 
       */
      async runVideo(message, connection, videoUrl) {
          const server = message.client.server;
          const dispatcher = connection.play(await ytdl(videoUrl, {filter: 'audioonly'}), { type: 'opus' });
          
          server.queue.shift();
          server.dispatcher = dispatcher;
          server.connection = null
  
          dispatcher.on('finish', () =&gt; {
              if (server.queue[0]) {
                  server.currentVideo = server.queue[0]; 
                  return this.runVideo(message, connection, server.currentVideo.url);
              }
          });
  
          return message.say(&quot;En train de jouer :notes:&quot;);
      }
  }
  </code></pre>
  <p><strong>Skip command:</strong></p>
  <pre><code>const { Command, CommandoMessage } = require(&quot;discord.js-commando&quot;);
  const {UserNotInVoiceChannel, BotNotInVoiceChannel } = require(`../../strings.json`);
  
  
  module.exports = class skipCommand extends Command {
      constructor(client) {
          super(client, {
              name: `skip`,
              group: `music`,
              memberName: `skip`,
              description: `Skip la video.`
          });
      }
  
      /**
       * 
       * @param {CommandoMessage} message 
       * @param {String} query 
       */
      async run(message) {
          const voiceChannel = message.member.voice.channel;
          const server = message.client.server;
  
          if(!voiceChannel){
              return message.say(UserNotInVoiceChannel)
          }
  
          if (!message.client.voice.connections.first()) {
              return message.say(BotNotInVoiceChannel);
          }
          
          server.queue.shift();
  
          if (!server.queue[0]) {
              server.currentVideo = {url: &quot;&quot;, title: &quot;Rien pour le moment&quot;}
  
          }
  
          server.currentVideo = server.queue[0];
          server.connection.play(await ytdl(server.currentVideo.url, {filter: 'audioonly'}), { type: 'opus' } );
  
          return message.say(&quot;:fast_foward: Ignoré :thumbsup:&quot;);
      }
  }
  </code></pre>