mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Fix
This commit is contained in:
@@ -2,7 +2,7 @@ const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { shorten, cleanAnilistHTML } = require('../../util/Util');
|
||||
const { cleanAnilistHTML } = require('../../util/Util');
|
||||
const searchGraphQL = stripIndents`
|
||||
query ($search: String, $type: MediaType, $isAdult: Boolean) {
|
||||
anime: Page (perPage: 1) {
|
||||
@@ -77,7 +77,7 @@ module.exports = class AnimeCommand extends Command {
|
||||
.setURL(anime.siteUrl)
|
||||
.setThumbnail(anime.coverImage.large || anime.coverImage.medium || null)
|
||||
.setTitle(anime.title.english || anime.title.userPreferred)
|
||||
.setDescription(anime.description ? shorten(cleanAnilistHTML(anime.description)) : 'No description.')
|
||||
.setDescription(anime.description ? cleanAnilistHTML(anime.description) : 'No description.')
|
||||
.addField('❯ Status', statuses[anime.status], true)
|
||||
.addField('❯ Episodes', anime.episodes || '???', true)
|
||||
.addField('❯ Season', anime.season ? `${seasons[anime.season]} ${anime.startDate.year}` : '???', true)
|
||||
|
||||
@@ -2,7 +2,7 @@ const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { shorten, cleanAnilistHTML } = require('../../util/Util');
|
||||
const { cleanAnilistHTML } = require('../../util/Util');
|
||||
const searchGraphQL = stripIndents`
|
||||
query ($search: String) {
|
||||
characters: Page (perPage: 1) {
|
||||
@@ -74,7 +74,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 ? shorten(cleanAnilistHTML(character.description)) : 'No description.')
|
||||
.setDescription(character.description ? cleanAnilistHTML(character.description) : 'No description.')
|
||||
.addField('❯ Appearances', character.media.edges.map(edge => {
|
||||
const title = edge.node.title.english || edge.node.title.userPreferred;
|
||||
return `[${title} (${types[edge.node.type]})](${edge.node.siteUrl})`;
|
||||
|
||||
@@ -2,7 +2,7 @@ const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { shorten, cleanAnilistHTML } = require('../../util/Util');
|
||||
const { cleanAnilistHTML } = require('../../util/Util');
|
||||
const searchGraphQL = stripIndents`
|
||||
query ($search: String, $type: MediaType, $isAdult: Boolean) {
|
||||
anime: Page (perPage: 1) {
|
||||
@@ -68,7 +68,7 @@ module.exports = class MangaCommand extends Command {
|
||||
.setURL(manga.siteUrl)
|
||||
.setThumbnail(manga.coverImage.large || manga.coverImage.medium || null)
|
||||
.setTitle(manga.title.english || manga.title.userPreferred)
|
||||
.setDescription(manga.description ? shorten(cleanAnilistHTML(manga.description)) : 'No description.')
|
||||
.setDescription(manga.description ? cleanAnilistHTML(manga.description) : 'No description.')
|
||||
.addField('❯ Status', statuses[manga.status], true)
|
||||
.addField('❯ Chapters / Volumes', `${manga.chapters || '???'}/${manga.volumes || '???'}`, true)
|
||||
.addField('❯ Year', manga.startDate.year || '???', true)
|
||||
|
||||
+2
-1
@@ -124,7 +124,8 @@ module.exports = class Util {
|
||||
.replace(/"/g, '"')
|
||||
.replace(/<\/?i>/g, '*')
|
||||
.replace(/~!|!~/g, '||');
|
||||
const spoilers = (clean.substr(0, 1997).match(/\|\|/g) || []).length;
|
||||
if (clean.length > 2000) clean = `${clean.substr(0, 1995)}...`;
|
||||
const spoilers = (clean.match(/\|\|/g) || []).length;
|
||||
if (spoilers !== 0 && (spoilers && (spoilers % 2))) clean += '||';
|
||||
return clean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user