Fix Error Messages

This commit is contained in:
Daniel Odendahl Jr
2017-05-16 12:17:52 +00:00
parent a140a30fcc
commit 897978ef73
46 changed files with 53 additions and 53 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ module.exports = class YearsCommand extends Command {
avatar.src = body;
generate();
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'az.png' }] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say('An Error Occurred while creating the image.');
}
+1 -1
View File
@@ -46,7 +46,7 @@ module.exports = class BeautifulCommand extends Command {
avatar.src = body;
generate();
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'grunkle.png' }] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say('An Error Occurred while creating the image.');
}
+1 -1
View File
@@ -49,7 +49,7 @@ module.exports = class BobRossCommand extends Command {
avatar.src = body;
generate();
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'ross.png' }] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say('An Error Occurred while creating the image.');
}
+1 -1
View File
@@ -68,7 +68,7 @@ module.exports = class CardCommand extends Command {
avatar.src = body;
generate();
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'card.png' }] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say('An Error Occurred while creating the image.');
}
+1 -1
View File
@@ -48,7 +48,7 @@ module.exports = class GreyscaleCommand extends Command {
avatar.src = avatarImg.body;
generate();
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'greyscale.png' }] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say('An Error Occurred while creating the image.');
}
+1 -1
View File
@@ -46,7 +46,7 @@ module.exports = class InvertCommand extends Command {
avatar.src = avatarImg.body;
generate();
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'invert.png' }] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say('An Error Occurred while creating the image.');
}
+1 -1
View File
@@ -54,7 +54,7 @@ module.exports = class RIPCommand extends Command {
avatar.src = avatarImg.body;
generate();
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'rip.png' }] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say('An Error Occurred while creating the image.');
}
+1 -1
View File
@@ -46,7 +46,7 @@ module.exports = class SimbaCommand extends Command {
avatar.src = body;
generate();
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'simba.png' }] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say('An Error Occurred while creating the image.');
}
+1 -1
View File
@@ -50,7 +50,7 @@ module.exports = class SteamCardCommand extends Command {
avatar.src = body;
generate();
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'card.png' }] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say('An Error Occurred while creating the image.');
}
+1 -1
View File
@@ -52,7 +52,7 @@ module.exports = class TriggeredCommand extends Command {
avatar.src = body;
generate();
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'triggered.png' }] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say('An Error Occurred while creating the image.');
}
+1 -1
View File
@@ -44,7 +44,7 @@ module.exports = class WantedCommand extends Command {
avatar.src = body;
generate();
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'wanted.png' }] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say('An Error Occurred while creating the image.');
}
+1 -1
View File
@@ -67,7 +67,7 @@ module.exports = class BanCommand extends Command {
`);
return modlogs.send({ embed });
} catch (err) {
return msg.say(err);
return msg.say('No Results.');
}
}
};
+1 -1
View File
@@ -66,7 +66,7 @@ module.exports = class KickCommand extends Command {
`);
return modlogs.send({ embed });
} catch (err) {
return msg.say(err);
return msg.say('No Results.');
}
}
};
+2 -2
View File
@@ -40,14 +40,14 @@ module.exports = class LockdownCommand extends Command {
Please use \`lockdown stop\` to end the lockdown.
`);
} catch (err) {
return msg.say(err);
return msg.say('No Results.');
}
} else if (type === 'stop') {
try {
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: true });
return msg.say('Lockdown Ended, users without Administrator can now post messages.');
} catch (err) {
return msg.say(err);
return msg.say('No Results.');
}
}
}
+1 -1
View File
@@ -70,7 +70,7 @@ module.exports = class SoftbanCommand extends Command {
`);
return modlogs.send({ embed });
} catch (err) {
return msg.say(err);
return msg.say('No Results.');
}
}
};
+1 -1
View File
@@ -65,7 +65,7 @@ module.exports = class UnbanCommand extends Command {
`);
return modlogs.send({ embed });
} catch (err) {
return msg.say(err);
return msg.say('No Results.');
}
}
};
+1 -1
View File
@@ -53,7 +53,7 @@ module.exports = class CurrencyCommand extends Command {
const rate = body.rates[to];
return msg.say(`${amount} ${base} is ${amount * rate} ${to}.`);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred.');
}
}
};
+1 -1
View File
@@ -42,6 +42,6 @@ module.exports = class MemeCommand extends Command {
return msg.say('This Command requires the `Attach Files` Permission.');
const { type, top, bottom } = args;
return msg.say({ files: [`https://memegen.link/${type}/${top}/${bottom}.jpg`] })
.catch(err => msg.say(err));
.catch(err => msg.say('No Results.'));
}
};
+1 -1
View File
@@ -49,7 +49,7 @@ module.exports = class SoundboardCommand extends Command {
return null;
});
} catch (err) {
return msg.say(err);
return msg.say('No Results.');
}
}
};
+1 -1
View File
@@ -16,6 +16,6 @@ module.exports = class SpamCommand extends Command {
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return msg.say('This Command requires the `Attach Files` Permission.');
return msg.say({ files: [path.join(__dirname, '..', '..', 'assets', 'images', 'spam.png')] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
}
};
+1 -1
View File
@@ -46,7 +46,7 @@ module.exports = class StrawpollCommand extends Command {
http://strawpoll.me/${body.id}
`);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred.');
}
}
};
+1 -1
View File
@@ -30,7 +30,7 @@ module.exports = class TodayCommand extends Command {
.setDescription(`${event.year}: ${event.text}`);
return msg.embed(embed);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred.');
}
}
};
+1 -1
View File
@@ -27,7 +27,7 @@ module.exports = class WouldYouRatherCommand extends Command {
.setDescription(`${body.choicea} OR ${body.choiceb}?`);
return msg.embed(embed);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred.');
}
}
};
+2 -2
View File
@@ -20,9 +20,9 @@ module.exports = class CatCommand extends Command {
const { body } = await snekfetch
.get('http://random.cat/meow');
return msg.say({ files: [body.file] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred.');
}
}
};
+2 -2
View File
@@ -19,9 +19,9 @@ module.exports = class DogCommand extends Command {
const { body } = await snekfetch
.get('https://random.dog/woof.json');
return msg.say({ files: [body.url] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred.');
}
}
};
+1 -1
View File
@@ -18,6 +18,6 @@ module.exports = class XiaoCommand extends Command {
return msg.say('This Command requires the `Attach Files` Permission.');
const xiao = Math.floor(Math.random() * 10) + 1;
return msg.say({ files: [path.join(__dirname, '..', '..', 'assets', 'images', `xiaopai${xiao}.png`)] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
}
};
+3 -3
View File
@@ -32,16 +32,16 @@ module.exports = class XKCDCommand extends Command {
const current = await snekfetch
.get('https://xkcd.com/info.0.json');
if (type === 'today') return msg.say({ files: [current.body.img] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
else {
const random = Math.floor(Math.random() * current.body.num) + 1;
const { body } = await snekfetch
.get(`https://xkcd.com/${random}/info.0.json`);
return msg.say({ files: [body.img] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
}
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred.');
}
}
};
+1 -1
View File
@@ -57,7 +57,7 @@ module.exports = class AnimeCommand extends Command {
anime.entry[0].end_date[0], true);
return msg.embed(embed);
} catch (err) {
return msg.say('Error: No Results.');
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -43,7 +43,7 @@ module.exports = class BotSearchCommand extends Command {
body.prefix, true);
return msg.embed(embed);
} catch (err) {
return msg.say('No Results.');
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -42,7 +42,7 @@ module.exports = class DefineCommand extends Command {
.setDescription(body[0].text);
return msg.embed(embed);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -54,7 +54,7 @@ module.exports = class ForecastCommand extends Command {
`**High:** ${forecasts[6].high}°F, **Low:** ${forecasts[6].low}°F, **Condition:** ${forecasts[6].text}`);
return msg.embed(embed);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -35,7 +35,7 @@ module.exports = class GoogleCommand extends Command {
href = querystring.parse(href.replace('/url?', ''));
return message.edit(href.q);
} catch (err) {
return message.edit('Error: No Results.');
return message.edit('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -54,7 +54,7 @@ module.exports = class IMDBCommand extends Command {
body.Actors);
return msg.embed(embed);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+2 -2
View File
@@ -34,9 +34,9 @@ module.exports = class KonachanCommand extends Command {
});
if (!body.length) throw new Error('No Results.');
return msg.say(query ? `Result for ${query}:` : 'Random Image:', { files: [`https:${body[0].file_url}`] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -57,7 +57,7 @@ module.exports = class MangaCommand extends Command {
manga.entry[0].end_date[0], true);
return msg.embed(embed);
} catch (err) {
return msg.say('Error: No Results.');
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+2 -2
View File
@@ -45,9 +45,9 @@ module.exports = class MapCommand extends Command {
key: GOOGLE_KEY
});
return msg.say({ files: [{ attachment: body, name: 'map.png' }] })
.catch(err => msg.say(err));
.catch(() => msg.say('An Error Occurred while sending the image.'));
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -34,7 +34,7 @@ module.exports = class NeopetCommand extends Command {
if (!link.includes('cp')) throw new Error('Invalid Pet Name.');
return msg.say(link);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -64,7 +64,7 @@ module.exports = class OsuCommand extends Command {
body[0].count_rank_a, true);
return msg.embed(embed);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -51,7 +51,7 @@ module.exports = class SoundCloudCommand extends Command {
body[0].favoritings_count, true);
return msg.embed(embed);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -41,7 +41,7 @@ module.exports = class UrbanCommand extends Command {
body.list[0].example.substr(0, 2000) || 'None');
return msg.embed(embed);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -54,7 +54,7 @@ module.exports = class WattpadCommand extends Command {
body.stories[0].commentCount, true);
return msg.embed(embed);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -63,7 +63,7 @@ module.exports = class WeatherCommand extends Command {
body.query.results.channel.wind.speed, true);
return msg.embed(embed);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -45,7 +45,7 @@ module.exports = class WikipediaCommand extends Command {
.setDescription(body.query.pages[0].extract.substr(0, 2000).replace(/[\n]/g, '\n\n'));
return msg.embed(embed);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -45,7 +45,7 @@ module.exports = class YouTubeCommand extends Command {
.setThumbnail(body.items[0].snippet.thumbnails.default.url);
return msg.embed(embed);
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -59,7 +59,7 @@ module.exports = class YuGiOhCommand extends Command {
return msg.embed(embed);
}
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred. There were most likely no results.');
}
}
};
+1 -1
View File
@@ -36,7 +36,7 @@ module.exports = class WebhookCommand extends Command {
.send({ content });
return null;
} catch (err) {
return msg.say(err);
return msg.say('An Error Occurred.');
}
}
};