title: Guild member add
body: <p>Been trying to log into me console when a new person join a a new server my console reports the guild name and amount members but it doesnt seem to work the error I get is that guild is not defined.</p>
  <pre><code>client.on(&quot;guildMemberAdd&quot;, async (member) =&gt; {
    const channel = member.guild.channels.cache.find((ch) =&gt; ch.name === &quot;greetings&quot;);
    if (!channel) return;
  
    {
      var number = 31;
    }
    const image = Math.floor(Math.random() * (number - 1 + 1)) + 1;
    var rand = [
      &quot;Some retard just joined&quot;,
      &quot;This looser just made it&quot;,
      &quot;This cringe person just joined&quot;,
      &quot;LMAO look who joined&quot;,
      &quot;Incoming Pleb!!&quot;,
      &quot;Another Degenerate&quot;,
      &quot;Another Basement Dweller&quot;,
      &quot;Welcome you Wanker!!!&quot;,
    ];
    var choosen = rand[Math.floor(Math.random() * rand.length)];
  
    const canvas = Canvas.createCanvas(700, 250);
    const ctx = canvas.getContext(&quot;2d&quot;);
  
    const background = await Canvas.loadImage(`./welcome/` + image + &quot;.png&quot;);
    ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
  
    ctx.strokeStyle = &quot;#74037b&quot;;
    ctx.strokeRect(0, 0, canvas.width, canvas.height);
  
    ctx.font = &quot;35px sans-serif&quot;;
    ctx.fillStyle = &quot;#ffffff&quot;;
    ctx.fillText(`${choosen}`, canvas.width / 3, canvas.height / 3.5);
  
    ctx.font = (canvas, `${member.username}!`);
    ctx.fillStyle = &quot;#ffffff&quot;;
    ctx.fillText(`${member.displayName}!`, canvas.width / 2.9, canvas.height / 1.8);
  
    ctx.beginPath();
    ctx.arc(125, 125, 100, 0, Math.PI * 2, true);
    ctx.closePath();
    ctx.clip();
  
    const avatar = await Canvas.loadImage(member.user.displayAvatarURL({ format: &quot;jpg&quot; }));
    ctx.drawImage(avatar, 25, 25, 200, 200);
  
    const attachment = new Discord.MessageAttachment(canvas.toBuffer(), &quot;welcome-image.png&quot;);
  
    channel.send(attachment);
    console.log(`${member} was added to ${guild.name}\n Server now has:${guild.memberCount}`);
  });
  </code></pre>