Improved html tag deletion, more info on animes.

master
masterhc 1 year ago
parent bf2a9b15b2
commit 2a4e98224a

@ -58,11 +58,12 @@ class anime extends Command{
async function sendMessage(id)
{
const data = await new aniList().getAnimeInfo(id);
// console.log('Command: SearchChar: SendMessage: Data', data.season)
const embed = new EmbedBuilder()
.setTitle(`${data.title.romaji} (${data.title.native} / ${data.title.english})`)
.setTitle(`${data.title.romaji} (${data.title.native} / ${data.title.english?data.title.english:''})`)
.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
.setColor(0x003284)
.setDescription(data.description.replaceAll('~! ', '').replaceAll('<br>', ' ').substring(0, 1500) + "...")
.setDescription(data.description.replaceAll('~! ', '').replaceAll(/<[^>]*>/g, '').substring(0, 1500) + "...")
.setFooter({ text: 'Rem-Chan on', iconURL: 'https://i.imgur.com/g6FSNhL.png' })
.setImage(data.coverImage)
.setThumbnail(data.coverImage)
@ -71,7 +72,10 @@ class anime extends Command{
{name:'Status:', value:data.status, inline:true},
{name:'Episodes:', value:data.episodes?data.episodes.toString():'N/A', inline:true},
{name:'Trailer:', value:data.trailer?(data.trailer.site=='youtube'?`https://www.youtube.com/watch?v=${data.trailer.id}`:`https://www.dailymotion.com/video/${data.trailer.id}`):'N/A'},
{name:'Page', value:data.url, inline:true});
{name:'Release Season:', value:data.season, inline:true},
{name:'MAL Page', value:data.malLink, inline:true},
{name:'AniList Page', value:data.url, inline:true}
);
const randomID = Random();
const row = new ActionRowBuilder()
.addComponents(
@ -92,3 +96,4 @@ class anime extends Command{
}module.exports = anime;

@ -34,7 +34,7 @@ class char extends Command{
.setStyle(ButtonStyle.Success)
);
}
embed.setTitle(`First ${data.length>=4?'4':(data.length + ' and only')} results of search:`)
embed.setTitle(`First ${data.length>=4?'4':(data.length + ' and only')} result${data.length>1?'s':''} of search:`)
.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
.setColor(0x003284)
.setURL('https://www.rem.wordfights.com')
@ -59,12 +59,11 @@ class char extends Command{
async function sendMessage(id)
{
const data = await new aniList().getCharInfo(id);
console.log('Command: SearchChar: SendMessage: Data', typeof data.description)
const embed = new EmbedBuilder()
.setTitle(`${data.name.full} (${data.name.native})`)
.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
.setColor(0x003284)
.setDescription(data.description.replaceAll('~! ', '').replaceAll('<br>', ' ').substring(0, 1500) + "...")
.setDescription(data.description.replaceAll('~! ', '').replaceAll(/<[^>]*>/g, '').substring(0, 1500) + "...")
.setFooter({ text: 'Rem-Chan on', iconURL: 'https://i.imgur.com/g6FSNhL.png' })
.setImage(data.image)
.setThumbnail(data.image)

@ -65,7 +65,7 @@ class manga extends Command{
.setTitle(`${data.title.romaji} (${data.title.native} / ${data.title.english})`)
.setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png",url:'https://rem.wordfights.com/addtodiscord'})
.setColor(0x003284)
.setDescription(data.description.replaceAll('~! ', '').replaceAll('<br>', ' ').substring(0, 1500) + "...")
.setDescription(data.description.replaceAll('~! ', '').replaceAll(/<[^>]*>/g, '').substring(0, 1500) + "...")
.setFooter({ text: 'Rem-Chan on', iconURL: 'https://i.imgur.com/g6FSNhL.png' })
.addFields({name:'Page', value:data.url, inline:true})
.setImage(data.coverImage)

@ -673,7 +673,7 @@ class aniListCli {
variables
})
};
var data = await this.getInfo(options)
var data = await this.getInfo(options);
data = data.data.Page.media
if(!data[0]) return 'Error'
@ -705,6 +705,8 @@ class aniListCli {
siteUrl
status
episodes
season
seasonYear
trailer {
site
id
@ -727,15 +729,17 @@ class aniListCli {
})
};
var data = await this.getInfo(options);
data = data.data;
return {
title:data.data.Media.title,
malLink:'https://myanimelist.net/anime/'+data.data.Media.idMal,
status:data.data.Media.status,
url:data.data.Media.siteUrl,
episodes:data.data.Media.episodes,
trailer:data.data.Media.trailer,
description:data.data.Media.description,
coverImage:data.data.Media.coverImage.large
title:data.Media.title,
malLink:'https://myanimelist.net/anime/'+data.Media.idMal,
status:data.Media.status,
url:data.Media.siteUrl,
episodes:data.Media.episodes,
trailer:data.Media.trailer,
description:data.Media.description,
coverImage:data.Media.coverImage.large,
season: data.Media.season + data.Media.seasonYear
}
}
/**
@ -778,7 +782,7 @@ class aniListCli {
variables
})
};
var data = await this.getInfo(options)
var data = await this.getInfo(options);
var chars = data.data.Page.characters
var aux = [];
if(!chars[0]) return 'Error'
@ -827,13 +831,14 @@ class aniListCli {
variables
})
};
var data = await this.getInfo(options)
var data = await this.getInfo(options);
data = data.data;
return {
name:data.data.Character.name,
gender:data.data.Character.gender,
url:data.data.Character.siteUrl,
image:data.data.Character.image.medium,
description:data.data.Character.description,
name:data.Character.name,
gender:data.Character.gender,
url:data.Character.siteUrl,
image:data.Character.image.medium,
description:data.Character.description,
}
@ -876,7 +881,7 @@ class aniListCli {
variables
})
};
var data = await this.getInfo(options)
var data = await this.getInfo(options);
var mangas = data.data.Page.media;
var aux = [];
if(!mangas[0]) return 'Error'
@ -923,13 +928,14 @@ class aniListCli {
variables
})
};
var data = await this.getInfo(options)
var data = await this.getInfo(options);
data = data.data;
return {
title:data.data.Media.title,
status:data.data.Media.status,
url:data.data.Media.siteUrl,
description:data.data.Media.description,
coverImage:data.data.Media.coverImage.large
title:data.Media.title,
status:data.Media.status,
url:data.Media.siteUrl,
description:data.Media.description,
coverImage:data.Media.coverImage.large,
}
}

Loading…
Cancel
Save