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.
51 lines
2.0 KiB
51 lines
2.0 KiB
const {Command, aniList, Random} = require('../../lib.js')
|
|
|
|
const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
|
|
|
|
|
|
class char extends Command{
|
|
constructor(client){
|
|
super(client, {
|
|
name: 'char',
|
|
group:'pesquisa',
|
|
memberName: 'char',
|
|
description: 'Shows info about a character.'
|
|
|
|
})
|
|
}
|
|
async run(message, args)
|
|
{
|
|
const data = await new aniList().searchChar(args.join(' '));
|
|
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)//.split('~! ')[1].replaceAll('<br>', ' ').substring(0, 1500) + "...")
|
|
.setFooter({ text: 'Rem-Chan on', iconURL: 'https://i.imgur.com/g6FSNhL.png' })
|
|
.setImage(data.image)
|
|
.setThumbnail(data.image)
|
|
.setTimestamp()
|
|
.addFields(
|
|
{name:'Gender:', value:data.gender, inline:true});
|
|
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 = char;
|