node-pureimage icon indicating copy to clipboard operation
node-pureimage copied to clipboard

how to embed this in discord.js

Open Nit-nit opened this issue 3 years ago • 0 comments

client.on('messageCreate', (message) => {
  const img1 = PImage.make(100, 100)
  const ctx = img1.getContext('2d');
  ctx.fillStyle = 'red';
  ctx.fillRect(0,0,100,100);
  const attachment = new AttachmentBuilder();

  if (message.content.toLowerCase() === 'image') {
    const png = PImage.encodePNGToStream(img1, fs.createWriteStream('out.png'))
    .then(() => {
      message.reply(png)
    })
  }
});

Nit-nit avatar Oct 20 '22 00:10 Nit-nit