mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-19 05:51:42 +02:00
5 New Commands
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class GenderCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'gender',
|
||||
group: 'random',
|
||||
memberName: 'gender',
|
||||
description: 'Determines the gender of name.',
|
||||
args: [
|
||||
{
|
||||
key: 'name',
|
||||
prompt: 'What name do you want to determine the gender of?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { name }) {
|
||||
try {
|
||||
const { body } = await snekfetch
|
||||
.get('https://api.genderize.io/')
|
||||
.query({ name });
|
||||
if (!body.gender) return msg.say(`I have no idea what gender ${body.name} is.`);
|
||||
return msg.say(`I'm ${Math.round(body.probability * 100)}% sure ${body.name} is a ${body.gender} name.`);
|
||||
} catch (err) {
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user