mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 18:29:14 +02:00
Analyzers should reply
This commit is contained in:
@@ -31,8 +31,8 @@ module.exports = class FaceAnalyzeCommand extends Command {
|
|||||||
app_key: KAIROS_KEY
|
app_key: KAIROS_KEY
|
||||||
})
|
})
|
||||||
.send({ image: face });
|
.send({ image: face });
|
||||||
if (!body.images) return msg.say('There are no faces in this image.');
|
if (!body.images) return msg.reply('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[0].faces.length > 1) return msg.reply('Please provide only one face in the image.');
|
||||||
const data = body.images[0].faces[0].attributes;
|
const data = body.images[0].faces[0].attributes;
|
||||||
const race = races.sort((a, b) => data[b] - data[a])[0];
|
const race = races.sort((a, b) => data[b] - data[a])[0];
|
||||||
const gender = data.gender.maleConfidence > data.gender.femaleConfidence ? 'man' : 'woman';
|
const gender = data.gender.maleConfidence > data.gender.femaleConfidence ? 'man' : 'woman';
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ module.exports = class SevereToxicityCommand extends Command {
|
|||||||
requestedAttributes: { SEVERE_TOXICITY: {} }
|
requestedAttributes: { SEVERE_TOXICITY: {} }
|
||||||
});
|
});
|
||||||
const toxicity = Math.round(body.attributeScores.SEVERE_TOXICITY.summaryScore.value * 100);
|
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 >= 70) return msg.reply(`Likely to be perceived as toxic. (${toxicity}%)`);
|
||||||
if (toxicity >= 40) return msg.say(`Unsure if this will be perceived as toxic. (${toxicity}%)`);
|
if (toxicity >= 40) return msg.reply(`Unsure if this will be perceived as toxic. (${toxicity}%)`);
|
||||||
return msg.say(`Unlikely to be perceived as toxic. (${toxicity}%)`);
|
return msg.reply(`Unlikely to be perceived as toxic. (${toxicity}%)`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ module.exports = class ToxicityCommand extends Command {
|
|||||||
requestedAttributes: { TOXICITY: {} }
|
requestedAttributes: { TOXICITY: {} }
|
||||||
});
|
});
|
||||||
const toxicity = Math.round(body.attributeScores.TOXICITY.summaryScore.value * 100);
|
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 >= 70) return msg.reply(`Likely to be perceived as toxic. (${toxicity}%)`);
|
||||||
if (toxicity >= 40) return msg.say(`Unsure if this will be perceived as toxic. (${toxicity}%)`);
|
if (toxicity >= 40) return msg.reply(`Unsure if this will be perceived as toxic. (${toxicity}%)`);
|
||||||
return msg.say(`Unlikely to be perceived as toxic. (${toxicity}%)`);
|
return msg.reply(`Unlikely to be perceived as toxic. (${toxicity}%)`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "67.1.0",
|
"version": "67.1.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user