mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-11 15:57:50 +02:00
Fix anime-character command HTML
This commit is contained in:
@@ -389,10 +389,10 @@ Total: 456
|
|||||||
|
|
||||||
### Search:
|
### Search:
|
||||||
|
|
||||||
|
* **anime-character:** Searches AniList for your query, getting character results.
|
||||||
* **anime:** Searches AniList for your query, getting anime results.
|
* **anime:** Searches AniList for your query, getting anime results.
|
||||||
* **book:** Searches Google Books for a book.
|
* **book:** Searches Google Books for a book.
|
||||||
* **bulbapedia:** Searches Bulbapedia for your query.
|
* **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.
|
* **company:** Responds with the name and logo of a company.
|
||||||
* **country:** Responds with information on a country.
|
* **country:** Responds with information on a country.
|
||||||
* **danbooru:** Responds with an image from Danbooru, with optional query. (NSFW)
|
* **danbooru:** Responds with an image from Danbooru, with optional query. (NSFW)
|
||||||
|
|||||||
@@ -44,13 +44,13 @@ const types = {
|
|||||||
MANGA: 'Manga'
|
MANGA: 'Manga'
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = class CharacterCommand extends Command {
|
module.exports = class AnimeCharacterCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
super(client, {
|
super(client, {
|
||||||
name: 'character',
|
name: 'anime-character',
|
||||||
aliases: ['anilist-character', 'anime-character', 'manga-character', 'manga-char', 'ani-char', 'char'],
|
aliases: ['anilist-character', 'character', 'manga-character', 'manga-char', 'ani-char', 'char'],
|
||||||
group: 'search',
|
group: 'search',
|
||||||
memberName: 'character',
|
memberName: 'anime-character',
|
||||||
description: 'Searches AniList for your query, getting character results.',
|
description: 'Searches AniList for your query, getting character results.',
|
||||||
clientPermissions: ['EMBED_LINKS'],
|
clientPermissions: ['EMBED_LINKS'],
|
||||||
credit: [
|
credit: [
|
||||||
@@ -82,7 +82,7 @@ module.exports = class CharacterCommand extends Command {
|
|||||||
.setURL(character.siteUrl)
|
.setURL(character.siteUrl)
|
||||||
.setThumbnail(character.image.large || character.image.medium || null)
|
.setThumbnail(character.image.large || character.image.medium || null)
|
||||||
.setTitle(`${character.name.first || ''}${character.name.last ? ` ${character.name.last}` : ''}`)
|
.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 => {
|
.addField('❯ Appearances', character.media.edges.map(edge => {
|
||||||
const title = edge.node.title.english || edge.node.title.userPreferred;
|
const title = edge.node.title.english || edge.node.title.userPreferred;
|
||||||
return embedURL(`${title} (${types[edge.node.type]})`, edge.node.siteUrl);
|
return embedURL(`${title} (${types[edge.node.type]})`, edge.node.siteUrl);
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "116.1.2",
|
"version": "116.1.3",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+4
-3
@@ -175,9 +175,10 @@ module.exports = class Util {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cleanAnilistHTML(html) {
|
static cleanAnilistHTML(html, removeLineBreaks = true) {
|
||||||
let clean = html
|
let clean = html;
|
||||||
.replace(/\r|\n|\f/g, '')
|
if (removeLineBreaks) clean = clean.replace(/\r|\n|\f/g, '');
|
||||||
|
clean = clean
|
||||||
.replace(/<br>/g, '\n')
|
.replace(/<br>/g, '\n')
|
||||||
.replace(/'/g, '\'')
|
.replace(/'/g, '\'')
|
||||||
.replace(/"/g, '"')
|
.replace(/"/g, '"')
|
||||||
|
|||||||
Reference in New Issue
Block a user