You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.3 KiB

const {Command, aniList, Random} = require('../../lib.js')
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
class anime extends Command{
constructor(client){
super(client, {
name: 'anime',
group:'pesquisa',
memberName: 'anime',
description: 'Shows info about a anime.'
})
}
async run(message, args){
const data = await new aniList().searchAnime(args.join(' '));
const embed = new EmbedBuilder()
.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('<br>',' '))
.setFooter({ text: 'Rem-Chan on', iconURL: 'https://i.imgur.com/g6FSNhL.png' })
.setImage(data.coverImage)
.setThumbnail(data.coverImage)
.setTimestamp()
.addFields(
{name:'Status:', value:data.status, inline:true},
{name:'Episodes:', value:data.episodes.toString(), inline:true},
{name:'Trailer:', value:data.trailer?(data.trailer.site=='yotube'?`https://www.youtube.com/watch?v=${data.trailer.id}`:`https://www.dailymotion.com/video/${data.trailer.id}`):'N/A'});
const randomID = Random();
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId(randomID)
.setLabel('Remove this.')
.setStyle(ButtonStyle.Primary),
);
const filter = i => i.customId === randomID;
await message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
collector.on('collect', async m =>
{
message.delete();
m.message.delete();
});
}
}module.exports = anime;