mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-09 01:04:16 +02:00
Attempt to Fix Akinator
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
[
|
||||
"clownfull.mp3",
|
||||
"clownshort.mp3",
|
||||
"clownspam.mp3",
|
||||
"default.mp3",
|
||||
"distant.mp3",
|
||||
"echo.mp3",
|
||||
"fourtap.mp3",
|
||||
"highfartlong.mp3",
|
||||
"highfartshort.mp3",
|
||||
"midshort.mp3",
|
||||
"reverb.mp3",
|
||||
"spam.mp3",
|
||||
"tripletap.mp3",
|
||||
"truck.mp3"
|
||||
]
|
||||
@@ -45,6 +45,7 @@ module.exports = class AkinatorCommand extends Command {
|
||||
ans = answers.indexOf(msgs.first().content.toLowerCase());
|
||||
}
|
||||
const guess = await this.finish(msg.channel);
|
||||
if (!guess) return msg.reply('Hmm... I seem to be having a bit of trouble. Check back soon!');
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0xF78B26)
|
||||
.setTitle(`I'm ${Math.round(guess.proba * 100)}% sure it's...`)
|
||||
@@ -64,10 +65,11 @@ module.exports = class AkinatorCommand extends Command {
|
||||
|
||||
async createSession(channel) {
|
||||
const { body } = await snekfetch
|
||||
.get('http://api-en1.akinator.com/ws/new_session')
|
||||
.get('http://api-usa3.akinator.com/ws/new_session')
|
||||
.query({
|
||||
partner: 1,
|
||||
player: 'xiaobot'
|
||||
player: 'desktopPlayer',
|
||||
constraint: 'ETAT<>\'AV\''
|
||||
});
|
||||
const data = body.parameters;
|
||||
if (!data) return null;
|
||||
@@ -83,7 +85,7 @@ module.exports = class AkinatorCommand extends Command {
|
||||
async progress(channel, answer) {
|
||||
const session = this.sessions.get(channel.id);
|
||||
const { body } = await snekfetch
|
||||
.get('http://api-en1.akinator.com/ws/answer')
|
||||
.get('http://api-usa3.akinator.com/ws/answer')
|
||||
.query({
|
||||
session: session.id,
|
||||
signature: session.signature,
|
||||
@@ -104,7 +106,7 @@ module.exports = class AkinatorCommand extends Command {
|
||||
async finish(channel) {
|
||||
const session = this.sessions.get(channel.id);
|
||||
const { body } = await snekfetch
|
||||
.get('http://api-en1.akinator.com/ws/list')
|
||||
.get('http://api-usa3.akinator.com/ws/list')
|
||||
.query({
|
||||
session: session.id,
|
||||
signature: session.signature,
|
||||
@@ -112,6 +114,7 @@ module.exports = class AkinatorCommand extends Command {
|
||||
size: 1,
|
||||
mode_question: 0
|
||||
});
|
||||
if (!body.parameters) return null;
|
||||
return body.parameters.elements[0].element;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const sounds = require('../../assets/json/airhorn');
|
||||
const sounds = fs.readdirSync(path.join(__dirname, '..', '..', 'assets', 'sounds', 'airhorn'));
|
||||
|
||||
module.exports = class AirhornCommand extends Command {
|
||||
constructor(client) {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "75.1.0",
|
||||
"version": "75.1.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user