fixed commands

This commit is contained in:
loicbersier 2019-01-15 21:57:33 +01:00
parent 7e3375f6f2
commit dbcd5ec33a
6 changed files with 10 additions and 27 deletions

View file

@ -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');
});
}

View file

@ -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');
});
}
}

View file

@ -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');
});
}

View file

@ -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');
});
}

View file

@ -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');
});
}

View file

@ -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');
});
}