title: TypeError: Cannot read properties of null (reading 'id')
body: <p>So I was updating my bot to discord.js v13 and apparently my logging system has now broke, for some reason it can't read the ID of the guild where this log is occurring.</p>
  <p><strong>banAdd.js</strong></p>
  <pre class="lang-js prettyprint-override"><code>const { MessageEmbed} = require(&quot;discord.js&quot;);
  const {red_light} = require(&quot;../../other/colors.json&quot;);
  const Channel = require('../../models/ModerationModel.js');
  
  module.exports = async (bot, guild, user) =&gt; {
      const guildDB = await Channel.findOne({
         guildId: guild.id
       }, async (err, guild) =&gt; {
         if(err) console.error(err)
  
         if (!guild) {
           const newGuild = new Channel({
             guildId: guild.id,
             modChannel: null,
             msgChannel: null
           });
           await newGuild.save().then(result =&gt; console.log(result)).catch(err =&gt; console.error(err)); 
         }
       });   
  
      const modChannel = guild.channels.cache.get(guildDB.modChannel); 
  
    if (!modChannel) {
      return console.log(`No message channel found`);
    }
    let mEmbed = new MessageEmbed()
    .setAuthor(`Member Unbanned`, user.displayAvatarURL({dynamic : true}))
    .setColor(red_light)
    .setDescription(`${user} ${user.tag}`)
    .setThumbnail(`${user.displayAvatarURL({dynamic : true})}`)
    .setFooter(`ID: ${user.id}`)
    .setTimestamp()
    modChannel.send({embeds:[mEmbed]});
  }
  </code></pre>
  <p><strong>Error</strong></p>
  <pre class="lang-js prettyprint-override"><code>/home/runner/switch-beta-test/events/guild/banRemove.js:13
             guildId: guild.id,
                            ^
  
  TypeError: Cannot read properties of null (reading 'id')
      at /home/runner/switch-beta-test/events/guild/banRemove.js:13:27
      at /home/runner/switch-beta-test/node_modules/mongoose/lib/model.js:5074:18
      at processTicksAndRejections (node:internal/process/task_queues:78:11)
  </code></pre>
  <p>I have no idea why this is not working as it works in previous versions but updating to discord.js V13 completely broke this system. I tried looking at any possible solution but I can't find a single solution.</p>