A variety of fixes and a change in the way errors are handled.

This commit is contained in:
Daniel Odendahl Jr
2017-04-25 17:37:01 +00:00
parent d3dad31c6d
commit 49d092d7c1
51 changed files with 117 additions and 108 deletions
+2 -2
View File
@@ -29,14 +29,14 @@ module.exports = class MapCommand extends Command {
async run(message, args) {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES'))
return message.say(':x: Error! I don\'t have the Attach Files Permission!');
return message.say('This Command requires the `Attach Files` Permission.');
const { zoom, location } = args;
try {
const { body } = await request
.get(`https://maps.googleapis.com/maps/api/staticmap?center=${location}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`);
return message.channel.send({files: [{attachment: body}]});
} catch (err) {
return message.say(':x: Error! Something went wrong! Make sure you entered the location correctly!');
return message.say('An Error Occurred. The location may not have been found.');
}
}
};