From 35317956535e52cbd787af05c7c6810fead2f013 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Tue, 14 Nov 2017 21:59:51 +0000 Subject: [PATCH] Last name --- commands/other/gender-guess.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/commands/other/gender-guess.js b/commands/other/gender-guess.js index e9bf8171..ec1242a1 100644 --- a/commands/other/gender-guess.js +++ b/commands/other/gender-guess.js @@ -11,19 +11,29 @@ module.exports = class GenderGuessCommand extends Command { description: 'Determines the gender of name.', args: [ { - key: 'name', - prompt: 'What name do you want to determine the gender of?', + key: 'first', + label: 'first name', + prompt: 'What first name do you want to determine the gender of?', type: 'string', - max: 1950, - parse: name => encodeURIComponent(name) + max: 500, + parse: first => encodeURIComponent(first) + }, + { + key: 'last', + label: 'last name', + prompt: 'What last name do you want to determine the gender of?', + type: 'string', + default: 'null', + max: 500, + parse: last => encodeURIComponent(last) } ] }); } - async run(msg, { name }) { + async run(msg, { first, last }) { try { - const { body } = await snekfetch.get(`https://api.namsor.com/onomastics/api/json/gender/${name}/null`); + const { body } = await snekfetch.get(`https://api.namsor.com/onomastics/api/json/gender/${first}/${last}`); if (body.gender === 'unknown') return msg.say(`I have no idea what gender ${body.firstName} is.`); return msg.say(`I'm ${Math.abs(body.scale * 100)}% sure ${body.firstName} is a ${body.gender} name.`); } catch (err) {