Use custom emoji in spoopy-link

This commit is contained in:
Daniel Odendahl Jr
2018-10-04 15:15:12 +00:00
parent 5f643ba92a
commit 032d1bb092
4 changed files with 17 additions and 5 deletions
+12 -1
View File
@@ -1,6 +1,7 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const { stripIndents } = require('common-tags');
const { FAILURE_EMOJI_ID, SUCCESS_EMOJI_ID } = process.env;
module.exports = class SpoopyLinkCommand extends Command {
constructor(client) {
@@ -25,10 +26,20 @@ module.exports = class SpoopyLinkCommand extends Command {
const { body } = await request.get(`https://spoopy.link/api/${site}`);
return msg.say(stripIndents`
${body.safe ? 'Safe!' : 'Not safe...'}
${body.chain.map(url => `<${url.url}> ${url.safe ? '✅' : `❌ (${url.reasons.join(', ')})`}`).join('\n')}
${body.chain.map(
url => `<${url.url}> ${url.safe ? this.successEmoji : `${this.failureEmoji} (${url.reasons.join(', ')})`}`
).join('\n')}
`);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
get successEmoji() {
return SUCCESS_EMOJI_ID ? `<:success:${SUCCESS_EMOJI_ID}>` : '✅';
}
get failureEmoji() {
return FAILURE_EMOJI_ID ? `<:failure:${FAILURE_EMOJI_ID}>` : '❌';
}
};