/* Purge by servers Acept multiple servers Purge roleless members? Purge inactive members? Purge specific role? */ const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js'); const channelM = require('../../models/channels') const {Command, } = require('../../lib.js'); class purge extends Command{ constructor(client){ super(client, { name: 'removerustcommitschannel', aliases: ['unsetrustcommits','urustc'], description: 'Removes a channel from the rust commits feed.', needsAdmin:true, hidden:true }) } async run(message, args) { if(args.length==0) return sendMessage(false, 'No arguments') if(!typeof args[0]=='string' && isNaN(parseInt(args[0])) && !args[0].length==19) return sendMessage(false, 'Incorrect Arguments') channelM.find({cID:args[0]}).then(channel=> { if(channel.length==0) return sendMessage(false, 'ID not on the list.') channelM.findOneAndRemove(channel.id, (err)=> { if(!err) { sendMessage(true) } }) }).catch async function sendMessage(success,error) { const embed = new EmbedBuilder(); embed.setColor(0x27e33d); embed.setThumbnail('https://i.imgur.com/g6FSNhL.png'); const row = new ActionRowBuilder() .addComponents( new ButtonBuilder() .setCustomId('RemoveUnsetRustCommitsChannel') .setLabel('Remove this.') .setStyle(ButtonStyle.Primary), ); embed.addFields({name:success?'Removed':'Error', value:success?'Successfully removed from the list.':error}) await message.channel.send({ephemeral: true, embeds: [embed], components: [row] }); const filter = i => i.customId === 'RemoveUnsetRustCommitsChannel'; const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 }); collector.on('collect', async m => { message.delete(); m.message.delete() }); } } }module.exports = purge;