This commit is contained in:
Dragon Fire
2018-07-26 21:01:20 -04:00
parent 392cffec1c
commit d5aa3d4ab0
6 changed files with 13 additions and 15 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
"{{name}} does not play Candy Crush.\n{{name}} has a life.",
"{{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}} 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}} 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.",
+8 -9
View File
@@ -31,10 +31,12 @@ module.exports = class WhatAnimeCommand extends Command {
const { body } = await request.get(screenshot);
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 === '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(
`I'm ${result.probability}% sure this is from ${result.title} (${result.english}) episode #${result.episode}.`,
result.preview ? { files: [{ attachment: result.preview, name: 'anime.mp4' }] } : {}
`I'm ${result.prob}% sure this is from ${result.title}${result.episode
? ` episode ${result.episode}`
: ''}.`,
result.preview ? { files: [{ attachment: result.preview, name: 'preview.mp4' }] } : {}
);
} catch (err) {
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';
const { body } = await request
.post('https://whatanime.ga/api/search')
.query({ token: WHATANIME_KEY })
.attach('image', base64(file));
const data = body.docs[0];
if (data.is_adult && !nsfw) return 'nsfw';
return {
time: data.at * 1000,
probability: Math.round(data.similarity * 100),
prob: Math.round(data.similarity * 100),
episode: data.episode,
title: data.title_native,
english: data.title_english,
title: data.title_english,
preview: await this.fetchPreview(data),
nsfw: data.is_adult
};
+2 -2
View File
@@ -37,9 +37,9 @@ module.exports = class CurrencyCommand extends Command {
async run(msg, { base, target, amount }) {
try {
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.');
target = this.currencies[target] || this.currencies.find($ => $.currencyName.toLowerCase() === target);
target = this.currencies[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.`);
const rate = await this.fetchRate(base, target);
+1 -1
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
const sides = [NaN, 0, null, undefined, ''];
const sides = ['NaN', '0', 'null', 'undefined', '\'\''];
module.exports = class QuantumCoinCommand extends Command {
constructor(client) {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "85.4.0",
"version": "85.4.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
-1
View File
@@ -2,7 +2,6 @@ const { Command } = require('discord.js-commando');
class XiaoCommand extends Command {
constructor(client, info) {
if (typeof info.argsPromptLimit === 'undefined') info.argsPromptLimit = 0;
super(client, info);
this.argsSingleQuotes = info.argsSingleQuotes || false;