mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-05 22:01:54 +02:00
Last name
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user