Fix anime-character command HTML

This commit is contained in:
Dragon Fire
2020-06-05 00:19:58 -04:00
parent 672dc6641b
commit 1caa7352eb
4 changed files with 11 additions and 10 deletions
+1 -1
View File
@@ -389,10 +389,10 @@ Total: 456
### Search:
* **anime-character:** Searches AniList for your query, getting character results.
* **anime:** Searches AniList for your query, getting anime results.
* **book:** Searches Google Books for a book.
* **bulbapedia:** Searches Bulbapedia for your query.
* **character:** Searches AniList for your query, getting character results.
* **company:** Responds with the name and logo of a company.
* **country:** Responds with information on a country.
* **danbooru:** Responds with an image from Danbooru, with optional query. (NSFW)
@@ -44,13 +44,13 @@ const types = {
MANGA: 'Manga'
};
module.exports = class CharacterCommand extends Command {
module.exports = class AnimeCharacterCommand extends Command {
constructor(client) {
super(client, {
name: 'character',
aliases: ['anilist-character', 'anime-character', 'manga-character', 'manga-char', 'ani-char', 'char'],
name: 'anime-character',
aliases: ['anilist-character', 'character', 'manga-character', 'manga-char', 'ani-char', 'char'],
group: 'search',
memberName: 'character',
memberName: 'anime-character',
description: 'Searches AniList for your query, getting character results.',
clientPermissions: ['EMBED_LINKS'],
credit: [
@@ -82,7 +82,7 @@ module.exports = class CharacterCommand extends Command {
.setURL(character.siteUrl)
.setThumbnail(character.image.large || character.image.medium || null)
.setTitle(`${character.name.first || ''}${character.name.last ? ` ${character.name.last}` : ''}`)
.setDescription(character.description ? cleanAnilistHTML(character.description) : 'No description.')
.setDescription(character.description ? cleanAnilistHTML(character.description, false) : 'No description.')
.addField(' Appearances', character.media.edges.map(edge => {
const title = edge.node.title.english || edge.node.title.userPreferred;
return embedURL(`${title} (${types[edge.node.type]})`, edge.node.siteUrl);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "116.1.2",
"version": "116.1.3",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
+4 -3
View File
@@ -175,9 +175,10 @@ module.exports = class Util {
return false;
}
static cleanAnilistHTML(html) {
let clean = html
.replace(/\r|\n|\f/g, '')
static cleanAnilistHTML(html, removeLineBreaks = true) {
let clean = html;
if (removeLineBreaks) clean = clean.replace(/\r|\n|\f/g, '');
clean = clean
.replace(/<br>/g, '\n')
.replace(/&#039;/g, '\'')
.replace(/&quot;/g, '"')