mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix Error Messages
This commit is contained in:
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ module.exports = class SoundboardCommand extends Command {
|
||||
return null;
|
||||
});
|
||||
} catch (err) {
|
||||
return msg.say(err);
|
||||
return msg.say('No Results.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user