title: UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'voice' of undefined
body: <p>So I'm trying to make a command to play music in a vc, but here's my problem whenever I run the command it gives me this error <code>(node:11) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'voice' of undefined</code> whenever I try to do anything with this command it doesn't work. It just gives me that error over and over and over again. I haven't found any fix to this yet but I'll keep looking. If any of you find out how to fix this please answer my post.</p>
  <p><strong>code:</strong></p>
  <pre><code>const { Util, voice, Client } = require('discord.js');
  const bot = new Client();
  
  module.exports.run = async(message, args) =&gt; {
  const channel = message.member.voice.channel.join
      if (!channel) return message.channel.send('I\'m sorry but you need to be in a voice channel to play music!');
      const permissions = channel.permissionsFor(message.client.user);
      if (!permissions.has('CONNECT')) return message.channel.send('I cannot connect to your voice channel, make sure I have the proper permissions!');
      if (!permissions.has('SPEAK')) return message.channel.send('I cannot speak in this voice channel, make sure I have the proper permissions!');
  
      const serverQueue = message.client.queue.get(message.guild.id);
      const songInfo = await ytdl.getInfo(args[0].replace(/&lt;(.+)&gt;/g, '$1'));
      const song = {
          id: songInfo.videoDetails.video_id,
          title: Util.escapeMarkdown(songInfo.videoDetails.title),
          url: songInfo.videoDetails.video_url
      };
  
      if (serverQueue) {
          serverQueue.songs.push(song);
          console.log(serverQueue.songs);
          return message.channel.send(`✅ **${song.title}** has been added to the queue!`);
      }
  
      const queueConstruct = {
          textChannel: message.channel,
          voiceChannel: channel,
          connection: null,
          songs: [],
          volume: 2,
          playing: true
      };
      message.client.queue.set(message.guild.id, queueConstruct);
      queueConstruct.songs.push(song);
  
      const play = async song =&gt; {
          const queue = message.client.queue.get(message.guild.id);
          if (!song) {
              queue.voiceChannel.leave();
              message.client.queue.delete(message.guild.id);
              return;
          }
  
          const dispatcher = queue.connection.play(ytdl(song.url))
              .on('finish', () =&gt; {
                  queue.songs.shift();
                  play(queue.songs[0]);
              })
              .on('error', error =&gt; console.error(error));
          dispatcher.setVolumeLogarithmic(queue.volume / 5);
          queue.textChannel.send(` Start playing: **${song.title}**`);
      };
  
      try {
          const connection = await channel.join();
          queueConstruct.connection = connection;
          play(queueConstruct.songs[0]);
      } catch (error) {
          console.error(`I could not join the voice channel: ${error}`);
          message.client.queue.delete(message.guild.id);
          await channel.leave();
          return message.channel.send(`I could not join the voice channel: ${error}`);
      }
  }
  
  module.exports.help = {
      name: &quot;play&quot;,
      aliases: []
  }```
  </code></pre>