mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 15:57:54 +02:00
shorten in Util
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { cleanXML } = require('../../structures/Util');
|
||||
const { cleanXML, shorten } = require('../../structures/Util');
|
||||
const { promisify } = require('util');
|
||||
const xml = promisify(require('xml2js').parseString);
|
||||
const { ANIMELIST_LOGIN } = process.env;
|
||||
@@ -31,14 +31,14 @@ module.exports = class AnimeCommand extends Command {
|
||||
.get(`https://${ANIMELIST_LOGIN}@myanimelist.net/api/anime/search.xml`)
|
||||
.query({ q: query });
|
||||
const { anime } = await xml(text);
|
||||
const synopsis = cleanXML(anime.entry[0].synopsis[0].substr(0, 2048));
|
||||
const synopsis = cleanXML(anime.entry[0].synopsis[0]);
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x2D54A2)
|
||||
.setAuthor('My Anime List', 'https://i.imgur.com/R4bmNFz.png')
|
||||
.setURL(`https://myanimelist.net/anime/${anime.entry[0].id[0]}`)
|
||||
.setThumbnail(anime.entry[0].image[0])
|
||||
.setTitle(`${anime.entry[0].title[0]} (English: ${anime.entry[0].english[0] || 'N/A'})`)
|
||||
.setDescription(synopsis)
|
||||
.setDescription(shorten(synopsis))
|
||||
.addField('❯ Type',
|
||||
`${anime.entry[0].type[0]} - ${anime.entry[0].status[0]}`, true)
|
||||
.addField('❯ Episodes',
|
||||
|
||||
Reference in New Issue
Block a user