mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 10:25:11 +02:00
Bug Catching in File Commands
This commit is contained in:
@@ -35,7 +35,7 @@ module.exports = class YearsCommand extends Command {
|
|||||||
az.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
az.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if (err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
return msg.channel.send({files: [{attachment: buff}]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ module.exports = class BeautifulCommand extends Command {
|
|||||||
grunkle.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
grunkle.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if (err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
return msg.channel.send({files: [{attachment: buff}]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ module.exports = class BobRossCommand extends Command {
|
|||||||
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if (err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
return msg.channel.send({files: [{attachment: buff}]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ module.exports = class GreyscaleCommand extends Command {
|
|||||||
avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if (err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
return msg.channel.send({files: [{attachment: buff}]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ module.exports = class InvertCommand extends Command {
|
|||||||
avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if (err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
return msg.channel.send({files: [{attachment: buff}]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ module.exports = class RIPCommand extends Command {
|
|||||||
grave.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
grave.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if (err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
return msg.channel.send({files: [{attachment: buff}]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ module.exports = class SteamCardCommand extends Command {
|
|||||||
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if (err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
return msg.channel.send({files: [{attachment: buff}]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ module.exports = class TriggeredCommand extends Command {
|
|||||||
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if (err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
return msg.channel.send({files: [{attachment: buff}]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ module.exports = class WantedCommand extends Command {
|
|||||||
wanted.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
wanted.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if (err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
return msg.channel.send({files: [{attachment: buff}]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,6 +49,6 @@ module.exports = class MemeCommand extends Command {
|
|||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const { type, top, bottom } = args;
|
const { type, top, bottom } = args;
|
||||||
return msg.channel.send({files: [`https://memegen.link/${type}/${top}/${bottom}.jpg`]})
|
return msg.channel.send({files: [`https://memegen.link/${type}/${top}/${bottom}.jpg`]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ module.exports = class SpamCommand extends Command {
|
|||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
return msg.channel.send({files: ['https://i.imgur.com/2JFu5xE.jpg']})
|
return msg.channel.send({files: ['https://i.imgur.com/2JFu5xE.jpg']})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,8 +45,7 @@ module.exports = class StrawpollCommand extends Command {
|
|||||||
options: choices
|
options: choices
|
||||||
});
|
});
|
||||||
return msg.say(`${body.title}\nhttp://strawpoll.me/${body.id}`);
|
return msg.say(`${body.title}\nhttp://strawpoll.me/${body.id}`);
|
||||||
}
|
} catch (err) {
|
||||||
catch (err) {
|
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ module.exports = class CatCommand extends Command {
|
|||||||
const { body } = await request
|
const { body } = await request
|
||||||
.get('http://random.cat/meow');
|
.get('http://random.cat/meow');
|
||||||
return msg.channel.send({files: [body.file]})
|
return msg.channel.send({files: [body.file]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module.exports = class DogCommand extends Command {
|
|||||||
const { body } = await request
|
const { body } = await request
|
||||||
.get('https://random.dog/woof.json');
|
.get('https://random.dog/woof.json');
|
||||||
return msg.channel.send({files: [body.url]})
|
return msg.channel.send({files: [body.url]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,6 @@ module.exports = class XiaoCommand extends Command {
|
|||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const xiao = xiaos[Math.floor(Math.random() * xiaos.length)];
|
const xiao = xiaos[Math.floor(Math.random() * xiaos.length)];
|
||||||
return msg.channel.send({files: [xiao]})
|
return msg.channel.send({files: [xiao]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ module.exports = class MapCommand extends Command {
|
|||||||
const { body } = await request
|
const { body } = await request
|
||||||
.get(`https://maps.googleapis.com/maps/api/staticmap?center=${query}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`);
|
.get(`https://maps.googleapis.com/maps/api/staticmap?center=${query}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`);
|
||||||
return msg.channel.send({files: [{attachment: body}]})
|
return msg.channel.send({files: [{attachment: body}]})
|
||||||
.catch(() => msg.say('An Unknown Error Occurred.'));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return msg.say('An Error Occurred. The location may not have been found.');
|
return msg.say('An Error Occurred. The location may not have been found.');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user