title: Why is my channel undefined?
body: <p>I'm working on a Discord bot that will take complaints via DMs and post them in a chat room to be seen by moderators.  For some reason, the type is considered undefined.  The exact error text is this:</p>
  
  <pre><code>TypeError: Cannot read property '44640...' of undefined
  </code></pre>
  
  <p>The error comes from this line:</p>
  
  <pre><code>if (bot.channel[channelID].type == 1) 
  </code></pre>
  
  <p>If the channel ID itself is considered undefined, then I believe this means the channel itself is not defined.</p>
  
  <p>Here is the full code of the function:</p>
  
  <pre><code>bot.on('message', function (user, userID, channelID, message, evt) {
  // Our bot needs to know if it will execute a command
  // It will listen for messages that will start with `s!`
  if (message.substring(0, 2) == 's!') {
      var args = message.substring(2).split(' ');
      var cmd = args[0];
  
      args = args.splice(2);
      switch(cmd) {
          // s!ping
          case 'ping':
              bot.sendMessage({
                  to: channelID,
                  message: 'Pong!'
              });
          break;
  
          case 'problem':
          if (bot.channel[channelID].type == 1) 
          {
              var embed = new Discord.RichEmbed()
              .setAuthor(message.author.username, message.author.avatarURL)
              .setDescription(message.content)
              .setTimestamp(new Date())
              .setColor('#C735D4');
              //stores the sent message, along with the sender and the time of the message
  
              client.channels.get(446393832066514947).send(embed);
              //sends message to channel
          }
          // Just add any case commands if you want to..
       }
   }
  });
  </code></pre>