diff --git a/commands/images/fetish.js b/commands/images/fetish.js index 5a067592..4585a486 100644 --- a/commands/images/fetish.js +++ b/commands/images/fetish.js @@ -1,5 +1,4 @@ const { Command } = require('discord-akairo'); -const Discord = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const superagent = require('superagent'); @@ -11,7 +10,8 @@ class FetishCommand extends Command { args: [ { id: 'image', - type: 'string' + type: 'string', + optional: true, } ] }); @@ -40,10 +40,8 @@ class FetishCommand extends Command { const bg = await loadImage(buffer); ctx.drawImage(bg, 50, 50, 450, 450); - const attachment = new Discord.Attachment(canvas.toBuffer(), 'myfetish.png'); - - message.channel.send(attachment).catch(() => { + message.channel.send({files: [canvas.toBuffer()]}).catch(() => { message.channel.send('an error as occured. Check the bot/channel permissions'); }); } diff --git a/commands/images/god.js b/commands/images/god.js index b8d0ffdc..50897dd7 100644 --- a/commands/images/god.js +++ b/commands/images/god.js @@ -1,5 +1,4 @@ const { Command } = require('discord-akairo'); -const Discord = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const superagent = require('superagent'); @@ -41,13 +40,10 @@ class GodCommand extends Command { const bg = await loadImage(buffer); ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); - const attachment = new Discord.Attachment(canvas.toBuffer(), 'god.png'); - message.delete(); - message.channel.send(attachment) - .catch(() => { - message.channel.send('an error as occured. Check the bot/channel permissions'); - }); + message.channel.send({files: [canvas.toBuffer()]}).catch(() => { + message.channel.send('an error as occured. Check the bot/channel permissions'); + }); } } diff --git a/commands/images/idubbbz.js b/commands/images/idubbbz.js index 9424a893..2ad16254 100644 --- a/commands/images/idubbbz.js +++ b/commands/images/idubbbz.js @@ -1,5 +1,4 @@ const { Command } = require('discord-akairo'); -const Discord = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const superagent = require('superagent'); @@ -65,9 +64,8 @@ class IdubbbzCommand extends Command { ctx.fillStyle = '#000000'; ctx.fillText(text, canvas.width / 2.1, canvas.height / 1.5); - const attachment = new Discord.Attachment(canvas.toBuffer(), 'edups.png'); - message.channel.send(attachment).catch(() => { + message.channel.send({files: [canvas.toBuffer()]}).catch(() => { message.channel.send('an error as occured. Check the bot/channel permissions'); }); } diff --git a/commands/images/idubbbzpaint.js b/commands/images/idubbbzpaint.js index 843f4f2b..7edbb284 100644 --- a/commands/images/idubbbzpaint.js +++ b/commands/images/idubbbzpaint.js @@ -1,5 +1,4 @@ const { Command } = require('discord-akairo'); -const Discord = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const superagent = require('superagent'); @@ -64,9 +63,7 @@ class IdubbbzPaintCommand extends Command { ctx.fillStyle = '#ffffff'; ctx.fillText(text, canvas.width / 3, canvas.height / 1.1); - const attachment = new Discord.Attachment(canvas.toBuffer(), 'edupspaint.png'); - - message.channel.send(attachment).catch(() => { + message.channel.send({files: [canvas.toBuffer()]}).catch(() => { message.channel.send('an error as occured. Check the bot/channel permissions'); }); } diff --git a/commands/images/like.js b/commands/images/like.js index 56571f1e..c3545cc8 100644 --- a/commands/images/like.js +++ b/commands/images/like.js @@ -1,5 +1,4 @@ const { Command } = require('discord-akairo'); -const Discord = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const superagent = require('superagent'); @@ -41,9 +40,7 @@ class LikeCommand extends Command { const bg = await loadImage(buffer); ctx.drawImage(bg, 0, 0, canvas.width, canvas.height); - const attachment = new Discord.Attachment(canvas.toBuffer(), 'like.png'); - - message.channel.send(attachment).catch(() => { + message.channel.send({files: [canvas.toBuffer()]}).catch(() => { message.channel.send('an error as occured. Check the bot/channel permissions'); }); } diff --git a/commands/images/ugly.js b/commands/images/ugly.js index 005f3dea..7506820c 100644 --- a/commands/images/ugly.js +++ b/commands/images/ugly.js @@ -1,5 +1,4 @@ const { Command } = require('discord-akairo'); -const Discord = require('discord.js'); const { createCanvas, loadImage } = require('canvas'); const superagent = require('superagent'); @@ -41,9 +40,7 @@ class UglyCommand extends Command { const bg = await loadImage(buffer); ctx.drawImage(bg, 40, 100, 250, 250); - const attachment = new Discord.Attachment(canvas.toBuffer(), 'ugly.png'); - - message.channel.send(attachment).catch(() => { + message.channel.send({files: [canvas.toBuffer()]}).catch(() => { message.channel.send('an error as occured. Check the bot/channel permissions'); }); }