Add Region Picking to Akinator

This commit is contained in:
Dragon Fire
2020-05-19 12:24:27 -04:00
parent 8af6007ced
commit 36e343a6d8
3 changed files with 41 additions and 4 deletions
+25
View File
@@ -0,0 +1,25 @@
[
"en",
"en_object",
"en_animals",
"ar",
"cn",
"de",
"de_animals",
"es",
"es_animals",
"fr",
"fr_objects",
"fr_animals",
"il",
"it",
"it_animals",
"jp",
"jp_animals",
"kr",
"nl",
"pl",
"pt",
"ru",
"tr"
]
+15 -3
View File
@@ -2,7 +2,8 @@ const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const Aki = require('aki-api');
const { stripIndents } = require('common-tags');
const { verify } = require('../../util/Util');
const { list, verify } = require('../../util/Util');
const regions = require('../../assets/json/akinator');
module.exports = class AkinatorCommand extends Command {
constructor(client) {
@@ -12,6 +13,7 @@ module.exports = class AkinatorCommand extends Command {
group: 'games-sp',
memberName: 'akinator',
description: 'Think about a real or fictional character, I will try to guess who it is.',
details: `**Regions:** ${regions.join(', ')}`,
clientPermissions: ['EMBED_LINKS'],
credit: [
{
@@ -19,15 +21,25 @@ module.exports = class AkinatorCommand extends Command {
url: 'https://en.akinator.com/',
reason: 'API'
}
],
args: [
{
key: 'region',
prompt: `What region do you want to use? Either ${list(regions, 'or')}.`,
type: 'string',
default: 'en',
oneOf: regions,
parse: region => region.toLowerCase()
}
]
});
}
async run(msg) {
async run(msg, { region }) {
const current = this.client.games.get(msg.channel.id);
if (current) return msg.reply(`Please wait until the current game of \`${current.name}\` is finished.`);
try {
const aki = new Aki('en');
const aki = new Aki(region);
let ans = null;
let win = false;
let timesGuessed = 0;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "114.16.1",
"version": "114.16.2",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {