|
|
|
@ -51,22 +51,22 @@ class char extends Command{
|
|
|
|
|
// console.log(data.length, embeds.length, embeds)
|
|
|
|
|
|
|
|
|
|
const filter = i => i.customId.slice(0,-1) === randomID;
|
|
|
|
|
const sentMessage = await message.channel.send({ephemeral: true, embeds, components: [row] });
|
|
|
|
|
const Message = await message.channel.send({ephemeral: true, embeds, components: [row] });
|
|
|
|
|
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
|
|
|
|
collector.on('collect', async m =>
|
|
|
|
|
{
|
|
|
|
|
message.delete();
|
|
|
|
|
m.message.delete();
|
|
|
|
|
if(m.customId[m.customId.length-1]!=4) sendMessage(data[m.customId[m.customId.length-1]].id, this.client);
|
|
|
|
|
if(m.customId[m.customId.length-1]!=4) sendMessage(data[m.customId[m.customId.length-1]].id);
|
|
|
|
|
});
|
|
|
|
|
collector.on('end', async ()=>
|
|
|
|
|
{
|
|
|
|
|
this.client.guilds.cache.get(sentMessage.guildId).channels.cache.get(sentMessage.channelId).messages.cache.get(sentMessage.id).edit({ components: [] });
|
|
|
|
|
Message.edit({components:[]})
|
|
|
|
|
})
|
|
|
|
|
/**
|
|
|
|
|
* @param {Number} id
|
|
|
|
|
*/
|
|
|
|
|
async function sendMessage(id, client)
|
|
|
|
|
async function sendMessage(id)
|
|
|
|
|
{
|
|
|
|
|
const data = await new Anilist().getCharInfo(id);
|
|
|
|
|
data.description = data.description.replaceAll('~!', '').replaceAll('!~', '').replaceAll(/<[^>]*>/g, '');
|
|
|
|
@ -96,15 +96,15 @@ class char extends Command{
|
|
|
|
|
.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 });
|
|
|
|
|
const sentMessage = await message.channel.send({ephemeral: true, embeds: [embed], components: [row] });
|
|
|
|
|
const collector = message.channel.createMessageComponentCollector({ filter, time: 6})//0000 });
|
|
|
|
|
collector.on('collect', async m =>
|
|
|
|
|
{
|
|
|
|
|
m.message.delete();
|
|
|
|
|
});
|
|
|
|
|
collector.on('end', async ()=>
|
|
|
|
|
{
|
|
|
|
|
client.guilds.cache.get(sentMessage.guildId).channels.cache.get(sentMessage.channelId).messages.cache.get(sentMessage.id).edit({ components: [] });
|
|
|
|
|
sentMessage.edit({components:[]})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|