if no image send message about it and catch error
This commit is contained in:
parent
e6902ec5b1
commit
5e18aa5d67
6 changed files with 54 additions and 0 deletions
|
@ -32,6 +32,10 @@ class autocropCommand extends Command {
|
||||||
url = Attachment[0].url;
|
url = Attachment[0].url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
return message.channel.send('You need an image to use this command!');
|
||||||
|
}
|
||||||
|
|
||||||
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,10 +50,15 @@ class autocropCommand extends Command {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
return message.channel.send({files: [output]});
|
return message.channel.send({files: [output]});
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
return message.channel.send('Oh no, an error just occured! Maybe the format of your image don\'t work?');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ class blurCommand extends Command {
|
||||||
{
|
{
|
||||||
id: 'link',
|
id: 'link',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'radius',
|
id: 'radius',
|
||||||
|
@ -38,6 +39,10 @@ class blurCommand extends Command {
|
||||||
url = Attachment[0].url;
|
url = Attachment[0].url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
return message.channel.send('You need an image to use this command!');
|
||||||
|
}
|
||||||
|
|
||||||
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
||||||
|
|
||||||
jimp.read({
|
jimp.read({
|
||||||
|
@ -51,10 +56,15 @@ class blurCommand extends Command {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
return message.channel.send({files: [output]});
|
return message.channel.send({files: [output]});
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
return message.channel.send('Oh no, an error just occured! Maybe the format of your image don\'t work?');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,10 @@ class gaussianCommand extends Command {
|
||||||
url = Attachment[0].url;
|
url = Attachment[0].url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
return message.channel.send('You need an image to use this command!');
|
||||||
|
}
|
||||||
|
|
||||||
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
||||||
|
|
||||||
jimp.read({
|
jimp.read({
|
||||||
|
@ -51,10 +55,15 @@ class gaussianCommand extends Command {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
return message.channel.send({files: [output]});
|
return message.channel.send({files: [output]});
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
return message.channel.send('Oh no, an error just occured! Maybe the format of your image don\'t work?');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,10 @@ class jpegifyCommand extends Command {
|
||||||
url = Attachment[0].url;
|
url = Attachment[0].url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
return message.channel.send('You need an image to use this command!');
|
||||||
|
}
|
||||||
|
|
||||||
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
||||||
|
|
||||||
jimp.read({
|
jimp.read({
|
||||||
|
@ -45,9 +49,14 @@ class jpegifyCommand extends Command {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
return message.channel.send({files: [output]});
|
return message.channel.send({files: [output]});
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
return message.channel.send('Oh no, an error just occured! Maybe the format of your image don\'t work?');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,10 @@ class mirrorCommand extends Command {
|
||||||
url = Attachment[0].url;
|
url = Attachment[0].url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
return message.channel.send('You need an image to use this command!');
|
||||||
|
}
|
||||||
|
|
||||||
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
||||||
|
|
||||||
jimp.read({
|
jimp.read({
|
||||||
|
@ -45,6 +49,10 @@ class mirrorCommand extends Command {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
return message.channel.send({files: [output]});
|
return message.channel.send({files: [output]});
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
return message.channel.send('Oh no, an error just occured! Maybe the format of your image don\'t work?');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,10 @@ class rotateCommand extends Command {
|
||||||
url = Attachment[0].url;
|
url = Attachment[0].url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
return message.channel.send('You need an image to use this command!');
|
||||||
|
}
|
||||||
|
|
||||||
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
||||||
|
|
||||||
jimp.read({
|
jimp.read({
|
||||||
|
@ -49,10 +53,15 @@ class rotateCommand extends Command {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
return message.channel.send({files: [output]});
|
return message.channel.send({files: [output]});
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
return message.channel.send('Oh no, an error just occured! Maybe the format of your image don\'t work?');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue