Analyzers should reply

This commit is contained in:
Daniel Odendahl Jr
2018-03-08 23:53:44 +00:00
parent 10e9fc0c02
commit c965d443da
4 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -31,8 +31,8 @@ module.exports = class FaceAnalyzeCommand extends Command {
app_key: KAIROS_KEY
})
.send({ image: face });
if (!body.images) return msg.say('There are no faces in this image.');
if (body.images[0].faces.length > 1) return msg.say('Please provide only one face in the image.');
if (!body.images) return msg.reply('There are no faces in this image.');
if (body.images[0].faces.length > 1) return msg.reply('Please provide only one face in the image.');
const data = body.images[0].faces[0].attributes;
const race = races.sort((a, b) => data[b] - data[a])[0];
const gender = data.gender.maleConfidence > data.gender.femaleConfidence ? 'man' : 'woman';
+3 -3
View File
@@ -31,9 +31,9 @@ module.exports = class SevereToxicityCommand extends Command {
requestedAttributes: { SEVERE_TOXICITY: {} }
});
const toxicity = Math.round(body.attributeScores.SEVERE_TOXICITY.summaryScore.value * 100);
if (toxicity >= 70) return msg.say(`Likely to be perceived as toxic. (${toxicity}%)`);
if (toxicity >= 40) return msg.say(`Unsure if this will be perceived as toxic. (${toxicity}%)`);
return msg.say(`Unlikely to be perceived as toxic. (${toxicity}%)`);
if (toxicity >= 70) return msg.reply(`Likely to be perceived as toxic. (${toxicity}%)`);
if (toxicity >= 40) return msg.reply(`Unsure if this will be perceived as toxic. (${toxicity}%)`);
return msg.reply(`Unlikely to be perceived as toxic. (${toxicity}%)`);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+3 -3
View File
@@ -31,9 +31,9 @@ module.exports = class ToxicityCommand extends Command {
requestedAttributes: { TOXICITY: {} }
});
const toxicity = Math.round(body.attributeScores.TOXICITY.summaryScore.value * 100);
if (toxicity >= 70) return msg.say(`Likely to be perceived as toxic. (${toxicity}%)`);
if (toxicity >= 40) return msg.say(`Unsure if this will be perceived as toxic. (${toxicity}%)`);
return msg.say(`Unlikely to be perceived as toxic. (${toxicity}%)`);
if (toxicity >= 70) return msg.reply(`Likely to be perceived as toxic. (${toxicity}%)`);
if (toxicity >= 40) return msg.reply(`Unsure if this will be perceived as toxic. (${toxicity}%)`);
return msg.reply(`Unlikely to be perceived as toxic. (${toxicity}%)`);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "67.1.0",
"version": "67.1.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {