mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-19 21:40:51 +02:00
Fixes
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
"{{name}} does not play Candy Crush.\n{{name}} has a life.",
|
"{{name}} does not play Candy Crush.\n{{name}} has a life.",
|
||||||
"{{name}} is a jerk.",
|
"{{name}} is a jerk.",
|
||||||
"{{name}} wakes up and sees it snowing outside.\n{{name}} doesn't post about it because\nhe knows his friends also have windows.",
|
"{{name}} wakes up and sees it snowing outside.\n{{name}} doesn't post about it because\nhe knows his friends also have windows.",
|
||||||
"{{name}} knows tomorrow is Monday.\n{{name}} doesn't post about it, becuase\nhe knows it happens every week.",
|
"{{name}} knows tomorrow is Monday.\n{{name}} doesn't post about it, because\nhe knows it happens every week.",
|
||||||
"{{name}} doesn't shout at the TV\nwhen football is on.\n{{name}} knows they can't hear him.",
|
"{{name}} doesn't shout at the TV\nwhen football is on.\n{{name}} knows they can't hear him.",
|
||||||
"{{name}} pays attention in class instead of\nchatting with his friends on Discord.",
|
"{{name}} pays attention in class instead of\nchatting with his friends on Discord.",
|
||||||
"{{name}} has a good camera.\n{{name}} doesn't take useless photos\nand call himself a photographer.",
|
"{{name}} has a good camera.\n{{name}} doesn't take useless photos\nand call himself a photographer.",
|
||||||
|
|||||||
@@ -31,10 +31,12 @@ module.exports = class WhatAnimeCommand extends Command {
|
|||||||
const { body } = await request.get(screenshot);
|
const { body } = await request.get(screenshot);
|
||||||
const result = await this.search(body, msg.channel.nsfw);
|
const result = await this.search(body, msg.channel.nsfw);
|
||||||
if (result === 'size') return msg.reply('Please do not send an image larger than 1MB.');
|
if (result === 'size') return msg.reply('Please do not send an image larger than 1MB.');
|
||||||
if (result === 'nsfw') return msg.reply('This is from a hentai, and this isn\'t an NSFW channel, pervert.');
|
if (result.nsfw) return msg.reply('This is from a hentai, and this isn\'t an NSFW channel, pervert.');
|
||||||
return msg.reply(
|
return msg.reply(
|
||||||
`I'm ${result.probability}% sure this is from ${result.title} (${result.english}) episode #${result.episode}.`,
|
`I'm ${result.prob}% sure this is from ${result.title}${result.episode
|
||||||
result.preview ? { files: [{ attachment: result.preview, name: 'anime.mp4' }] } : {}
|
? ` episode ${result.episode}`
|
||||||
|
: ''}.`,
|
||||||
|
result.preview ? { files: [{ attachment: result.preview, name: 'preview.mp4' }] } : {}
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
@@ -52,20 +54,17 @@ module.exports = class WhatAnimeCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async search(file, nsfw) {
|
async search(file) {
|
||||||
if (Buffer.byteLength(file) > 1e+6) return 'size';
|
if (Buffer.byteLength(file) > 1e+6) return 'size';
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.post('https://whatanime.ga/api/search')
|
.post('https://whatanime.ga/api/search')
|
||||||
.query({ token: WHATANIME_KEY })
|
.query({ token: WHATANIME_KEY })
|
||||||
.attach('image', base64(file));
|
.attach('image', base64(file));
|
||||||
const data = body.docs[0];
|
const data = body.docs[0];
|
||||||
if (data.is_adult && !nsfw) return 'nsfw';
|
|
||||||
return {
|
return {
|
||||||
time: data.at * 1000,
|
prob: Math.round(data.similarity * 100),
|
||||||
probability: Math.round(data.similarity * 100),
|
|
||||||
episode: data.episode,
|
episode: data.episode,
|
||||||
title: data.title_native,
|
title: data.title_english,
|
||||||
english: data.title_english,
|
|
||||||
preview: await this.fetchPreview(data),
|
preview: await this.fetchPreview(data),
|
||||||
nsfw: data.is_adult
|
nsfw: data.is_adult
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ module.exports = class CurrencyCommand extends Command {
|
|||||||
async run(msg, { base, target, amount }) {
|
async run(msg, { base, target, amount }) {
|
||||||
try {
|
try {
|
||||||
if (!this.currencies) await this.fetchCurrencies();
|
if (!this.currencies) await this.fetchCurrencies();
|
||||||
base = this.currencies[base] || this.currencies.find($ => $.currencyName.toLowerCase() === base);
|
base = this.currencies[base];
|
||||||
if (!base) return msg.say('Invalid base.');
|
if (!base) return msg.say('Invalid base.');
|
||||||
target = this.currencies[target] || this.currencies.find($ => $.currencyName.toLowerCase() === target);
|
target = this.currencies[target];
|
||||||
if (!target) return msg.say('Invalid target.');
|
if (!target) return msg.say('Invalid target.');
|
||||||
if (base.id === target.id) return msg.say(`Converting ${base.id} to ${target.id} is the same value, dummy.`);
|
if (base.id === target.id) return msg.say(`Converting ${base.id} to ${target.id} is the same value, dummy.`);
|
||||||
const rate = await this.fetchRate(base, target);
|
const rate = await this.fetchRate(base, target);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const Command = require('../../structures/Command');
|
const Command = require('../../structures/Command');
|
||||||
const sides = [NaN, 0, null, undefined, ''];
|
const sides = ['NaN', '0', 'null', 'undefined', '\'\''];
|
||||||
|
|
||||||
module.exports = class QuantumCoinCommand extends Command {
|
module.exports = class QuantumCoinCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "85.4.0",
|
"version": "85.4.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ const { Command } = require('discord.js-commando');
|
|||||||
|
|
||||||
class XiaoCommand extends Command {
|
class XiaoCommand extends Command {
|
||||||
constructor(client, info) {
|
constructor(client, info) {
|
||||||
if (typeof info.argsPromptLimit === 'undefined') info.argsPromptLimit = 0;
|
|
||||||
super(client, info);
|
super(client, info);
|
||||||
|
|
||||||
this.argsSingleQuotes = info.argsSingleQuotes || false;
|
this.argsSingleQuotes = info.argsSingleQuotes || false;
|
||||||
|
|||||||
Reference in New Issue
Block a user