node-pureimage
node-pureimage copied to clipboard
how to embed this in discord.js
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)
})
}
});