diff --git a/README.md b/README.md index b8fde4f5..59dcda00 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ things, I'm not taking any chances. 19. Start Xiao up! ## Commands -Total: 516 +Total: 517 ### Utility: @@ -317,12 +317,13 @@ Total: 516 * **character-count:** Responds with the character count of text. * **chinese-zodiac:** Responds with the Chinese Zodiac Sign for the given year. * **dominant-color:** Determines the dominant color of an image. +* **face-gender:** Determines the gender of a face. * **faces:** Shows all detected faces in an image. -* **gender:** Determines the gender of a name. * **generation:** Responds with the Generation for the given year. * **image-size:** Determines the size of an image. * **is-it-down:** Determines if a website is down or not. * **levenshtein:** Determines the levenshtein distance between two strings. +* **name-gender:** Determines the gender of a name. * **nsfw-image:** Determines if an image is NSFW. * **nsfw-url:** Determines if a URL is NSFW. * **parse-time:** Analyzes the time duration you provide and gives the result. diff --git a/commands/analyze/face-gender.js b/commands/analyze/face-gender.js new file mode 100644 index 00000000..2c9b68e7 --- /dev/null +++ b/commands/analyze/face-gender.js @@ -0,0 +1,33 @@ +const Command = require('../../framework/Command'); +const request = require('node-superfetch'); + +module.exports = class FaceGenderCommand extends Command { + constructor(client) { + super(client, { + name: 'face-gender', + aliases: ['guess-face-gender', 'face-gender-guess', 'gender-face', 'gender'], + group: 'analyze', + description: 'Determines the gender of a face.', + credit: [ + { + name: 'Nyckel', + url: 'https://www.nyckel.com/pretrained-classifiers/gender-detector/', + reason: 'API' + } + ], + args: [ + { + key: 'image', + type: 'image' + } + ] + }); + } + + async run(msg, { image }) { + const { body } = await request + .post(`https://www.nyckel.com/v1/functions/gender-detector/invoke`) + .send({ data: image }); + return msg.say(`I'm ${Math.round(body.confidence * 100)}% sure this is a ${body.labelName}.`); + } +}; diff --git a/commands/analyze/gender.js b/commands/analyze/name-gender.js similarity index 82% rename from commands/analyze/gender.js rename to commands/analyze/name-gender.js index 1dfcc8c6..0bde17c5 100644 --- a/commands/analyze/gender.js +++ b/commands/analyze/name-gender.js @@ -1,11 +1,11 @@ const Command = require('../../framework/Command'); const request = require('node-superfetch'); -module.exports = class GenderCommand extends Command { +module.exports = class NameGenderCommand extends Command { constructor(client) { super(client, { - name: 'gender', - aliases: ['guess-gender', 'gender-guess'], + name: 'name-gender', + aliases: ['guess-name-gender', 'name-gender-guess', 'gender-name'], group: 'analyze', description: 'Determines the gender of a name.', credit: [ diff --git a/package.json b/package.json index dba2ef3c..79a4284b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "153.0.1", + "version": "153.1.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {