mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-15 15:57:47 +02:00
Add Region Picking to Akinator
This commit is contained in:
@@ -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"
|
||||||
|
]
|
||||||
@@ -2,7 +2,8 @@ const Command = require('../../structures/Command');
|
|||||||
const { MessageEmbed } = require('discord.js');
|
const { MessageEmbed } = require('discord.js');
|
||||||
const Aki = require('aki-api');
|
const Aki = require('aki-api');
|
||||||
const { stripIndents } = require('common-tags');
|
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 {
|
module.exports = class AkinatorCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -12,6 +13,7 @@ module.exports = class AkinatorCommand extends Command {
|
|||||||
group: 'games-sp',
|
group: 'games-sp',
|
||||||
memberName: 'akinator',
|
memberName: 'akinator',
|
||||||
description: 'Think about a real or fictional character, I will try to guess who it is.',
|
description: 'Think about a real or fictional character, I will try to guess who it is.',
|
||||||
|
details: `**Regions:** ${regions.join(', ')}`,
|
||||||
clientPermissions: ['EMBED_LINKS'],
|
clientPermissions: ['EMBED_LINKS'],
|
||||||
credit: [
|
credit: [
|
||||||
{
|
{
|
||||||
@@ -19,15 +21,25 @@ module.exports = class AkinatorCommand extends Command {
|
|||||||
url: 'https://en.akinator.com/',
|
url: 'https://en.akinator.com/',
|
||||||
reason: 'API'
|
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);
|
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.`);
|
if (current) return msg.reply(`Please wait until the current game of \`${current.name}\` is finished.`);
|
||||||
try {
|
try {
|
||||||
const aki = new Aki('en');
|
const aki = new Aki(region);
|
||||||
let ans = null;
|
let ans = null;
|
||||||
let win = false;
|
let win = false;
|
||||||
let timesGuessed = 0;
|
let timesGuessed = 0;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "114.16.1",
|
"version": "114.16.2",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user