const {Command, Random} = require('../../lib.js') const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js'); class Guilds extends Command { constructor(client) { super(client, { name: 'guilds', group:'admin', memberName: 'guilds', description: 'Shows a list of guilds that are using Rem-chan.' }) this.client = client; } async run(message, args) { const payload = {embeds:[]} var i = 0; for (const guild of this.client.guilds.cache) { if (!payload.embeds[Math.floor(i / 25)]) { payload.embeds.push( new EmbedBuilder() .setTitle('Servers hosting Rem-chan:') .setAuthor({name:"Rem-chan", iconURL:"https://i.imgur.com/g6FSNhL.png"}) .setColor(0xd31f1f) .setFooter({text:'Rem-chan em ', iconURL:"https://i.imgur.com/g6FSNhL.png"}) .setTimestamp() ) } payload.embeds[Math.floor(i/25)].addFields({name:guild[1].name, value:'With '+guild[1].members.cache.size+' Members'}) i++; } const costumID = Random(); const row = new ActionRowBuilder() .addComponents( new ButtonBuilder() .setCustomId(costumID) .setLabel('Remove this.') .setStyle(ButtonStyle.Primary), ); const Mesage = await message.channel.send({ephemeral: true, embeds: payload.embeds, components: [row] }); const filter = i => i.customId === costumID; const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 }); collector.on('collect', async m => { collector.stop(); message.delete(); m.message.delete(); }); collector.on('end', async ()=> { Message.edit({ components: [] }); }) } }module.exports = Guilds;