Various Fixes

This commit is contained in:
Dragon Fire
2021-01-12 21:51:38 -05:00
parent af8cf9858c
commit fc34b306bc
10 changed files with 1710 additions and 20 deletions
+6 -4
View File
@@ -260,7 +260,7 @@ in the appropriate channel's topic to use it.
## Commands
Total: 575
Total: 576
### Utility:
@@ -465,6 +465,7 @@ Total: 575
### Search:
* **anilist:** Responds with user information for an Anilist user.
* **anime-character:** Searches AniList for your query, getting character results.
* **anime-staff:** Searches AniList for your query, getting staff results.
* **anime:** Searches AniList for your query, getting anime results.
@@ -967,6 +968,7 @@ here.
- [Andrew Tyler](https://www.dafont.com/andrew-tyler.d2526)
* achievement ([Minecraftia Font](https://www.dafont.com/minecraftia.font))
- [AniList](https://anilist.co/)
* anilist ([API](https://anilist.gitbook.io/anilist-apiv2-docs/))
* anime ([API](https://anilist.gitbook.io/anilist-apiv2-docs/))
* anime-airing ([API](https://anilist.gitbook.io/anilist-apiv2-docs/))
* anime-character ([API](https://anilist.gitbook.io/anilist-apiv2-docs/))
@@ -1158,8 +1160,6 @@ here.
* rename-all (Concept)
- [Genderize.io](https://genderize.io/)
* gender (API)
- [Gerhard Jordan](http://www.gerhardjordan.com/)
* never-have-i-ever ([Statement Data](http://www.neverhaveiever.org/))
- [gfauchart](https://github.com/gfauchart)
* adorable ([API](https://github.com/adorableio/avatars-api-middleware/issues/108))
- [GIPHY](https://giphy.com/)
@@ -1589,6 +1589,8 @@ here.
* pornhub (Video Data)
- [Pottermore](https://my.pottermore.com/sorting)
* sorting-hat (Original Quiz)
- [PsyCat Games](https://psycatgames.com/)
* never-have-i-ever ([Statement Data](https://psycatgames.com/app/never-have-i-ever/))
- [PSYCHO-PASS](http://psycho-pass.com/)
* psycho-pass (Original Anime)
- [Psycho-Pass Wiki](https://psychopass.fandom.com/wiki/Psycho-Pass_Wiki)
@@ -1748,7 +1750,7 @@ here.
* ai-artwork (API)
- [This Cat Does Not Exist](https://thiscatdoesnotexist.com/)
* ai-cat (API)
- [This Fursona Does Not Exist](https://thisfursonadoesnotexist.com/)
- [This Fursona Does Not Exist](http://thisfursonadoesnotexist.com/)
* ai-fursona (API)
- [This Horse Does Not Exist](https://thishorsedoesnotexist.com/)
* ai-horse (API)
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -12,7 +12,7 @@ module.exports = class AiFursonaCommand extends Command {
credit: [
{
name: 'This Fursona Does Not Exist',
url: 'https://thisfursonadoesnotexist.com/',
url: 'http://thisfursonadoesnotexist.com/',
reason: 'API'
}
]
@@ -22,7 +22,7 @@ module.exports = class AiFursonaCommand extends Command {
run(msg) {
const num = Math.floor(Math.random() * 100000);
return msg.say(`AI-Generated Fursona #${num}`, {
files: [`https://thisfursonadoesnotexist.com/v2/jpgs/seed${num.toString().padStart(5, '0')}.jpg`]
files: [`http://thisfursonadoesnotexist.com/v2/jpgs/seed${num.toString().padStart(5, '0')}.jpg`]
});
}
};
+7 -10
View File
@@ -1,5 +1,6 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const { safe, nsfw } = require('../../assets/json/never-have-i-ever');
const all = [...safe, ...nsfw];
module.exports = class NeverHaveIEverCommand extends Command {
constructor(client) {
@@ -11,21 +12,17 @@ module.exports = class NeverHaveIEverCommand extends Command {
description: 'Responds with a random "Never Have I Ever..." statement.',
credit: [
{
name: 'Gerhard Jordan',
url: 'http://www.gerhardjordan.com/',
name: 'PsyCat Games',
url: 'https://psycatgames.com/',
reason: 'Statement Data',
reasonURL: 'http://www.neverhaveiever.org/'
reasonURL: 'https://psycatgames.com/app/never-have-i-ever/'
}
]
});
}
async run(msg) {
try {
const { text } = await request.get('http://www.neverhaveiever.org/randomtext.php');
return msg.say(text.match(/<h1>(.+)<\/h1>/i)[1].replaceAll('</br>', ''));
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
if (msg.channel.nsfw) return msg.say(all[Math.floor(Math.random() * all.length)]);
return msg.say(safe[Math.floor(Math.random() * safe.length)]);
}
};
+60
View File
@@ -0,0 +1,60 @@
const Command = require('../../structures/Command');
const searchGraphQL = stripIndents`
query ($name: String) {
users: Page (perPage: 1) {
results: users (name: $name) {
id
name
}
}
}
`;
module.exports = class AnilistCommand extends Command {
constructor(client) {
super(client, {
name: 'anilist',
aliases: ['anilist-user'],
group: 'search',
memberName: 'anilist',
description: 'Responds with user information for an Anilist user.',
clientPermissions: ['EMBED_LINKS'],
credit: [
{
name: 'AniList',
url: 'https://anilist.co/',
reason: 'API',
reasonURL: 'https://anilist.gitbook.io/anilist-apiv2-docs/'
}
],
args: [
{
key: 'query',
prompt: 'What user would you like to get the information of?',
type: 'string'
}
]
});
}
async run(msg, { query }) {
try {
const data = await this.search(query);
if (!data || !data.id || !data.name) return msg.say('Could not find any results.');
return msg.say(`https://anilist.co/user/${data.name}`, { files: [`https://img.anili.st/user/${data.id}`] });
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
async search(query) {
const { body } = await request
.post('https://graphql.anilist.co/')
.send({
variables: { search: query },
query: searchGraphQL
});
if (!body.data.users.results.length) return null;
return body.data.users.results[0];
}
};
+1 -1
View File
@@ -79,7 +79,7 @@ module.exports = class AnimeCommand extends Command {
constructor(client) {
super(client, {
name: 'anime',
aliases: ['anilist-anime', 'anilist', 'ani', 'myanimelist', 'mal', 'mal-score'],
aliases: ['anilist-anime', 'ani', 'myanimelist', 'mal', 'mal-score'],
group: 'search',
memberName: 'anime',
description: 'Searches AniList for your query, getting anime results.',
+2 -1
View File
@@ -2,6 +2,7 @@ const Command = require('../../structures/Command');
const moment = require('moment');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { decode: decodeHTML } = require('html-entities');
const { formatNumber, embedURL } = require('../../util/Util');
const { STACKOVERFLOW_KEY } = process.env;
@@ -51,7 +52,7 @@ module.exports = class StackOverflowCommand extends Command {
.setColor(0xF48023)
.setAuthor('Stack Overflow', 'https://i.imgur.com/P2jAgE3.png', 'https://stackoverflow.com/')
.setURL(data.link)
.setTitle(data.title)
.setTitle(decodeHTML(data.title))
.addField(' ID', data.question_id, true)
.addField(' Asker', embedURL(data.owner.display_name, data.owner.link), true)
.addField(' Views', formatNumber(data.view_count), true)
+1
View File
@@ -66,6 +66,7 @@ module.exports = class TwitterCommand extends Command {
return msg.embed(embed);
} catch (err) {
if (err.status === 401) await this.fetchToken();
if (err.status === 403) return msg.say('This user is either private or suspended.');
if (err.status === 404) return msg.say('Could not find any results.');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "124.5.7",
"version": "124.6.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
+3 -1
View File
@@ -137,8 +137,10 @@ module.exports = class Pokemon {
const versionGroup = move.version_group_details.find(mve => mve.version_group.name === this.moveSetVersion);
if (!versionGroup || !versionGroup.level_learned_at) continue;
const { body: moveBody } = await request.get(move.move.url);
const name = moveBody.names.find(name => name.language.name === 'en').name;
if (this.moveSet.some(move => move.name === name)) continue;
this.moveSet.push({
name: moveBody.names.find(name => name.language.name === 'en').name,
name,
level: versionGroup.level_learned_at
});
}