title: discord.js Getting the URL Of Canvas Attachment
body: <p>I am trying to get the URL of the attachment and send it to a channel , I tried to use <code>attachment.url</code> but but I'm getting <code>undefined</code>
  here is my code:</p>
  <pre class="lang-js prettyprint-override"><code>client.on('message', async message =&gt; {
  
              if (message.author.bot || message.channel.type === 'dm') return;
              if (message.content.toLowerCase().indexOf(prefix.toLowerCase()) !== 0) return;
              var args = message.content.slice(prefix.length).trim().split(/ +/g);
              var command = args.shift().toLowerCase();
  
              if(command =='image'){
              let args = message.content.split(&quot; &quot;).slice(1).join(' ');
              const canvas = Canvas.createCanvas(400, 140);
              const ctx = canvas.getContext('2d')
           
       
                  ctx.fillStyle = '#ffffff';
                  ctx.font = '150px serif';
                  ctx.shadowColor = 'black';
                  ctx.shadowBlur = 5;
                  ctx.fillText(`${args}`, 0, 118);
                  ctx.strokeStyle = '#000000';
                  ctx.strokeText(`${args}`, -1, 118);
                  ctx.textAlign = &quot;center&quot;;
                 
                 const attachment = new Discord.MessageAttachment(canvas.toBuffer(), 'image.png')
                 
          message.channel.send(`\`${attachment.url}\``)
          }})
  </code></pre>