Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let blacklists = require ('./blacklists.json')
- function saveB() {
- fs.writeFileSync ('./blacklists.json', JSON.stringify (blacklists, null, 4), (err) => {
- if (err) throw err;
- })
- }
- let settings = {
- "owners": ["owner id"]
- }
- client.on ('message', async (message) => {
- if (!message.guild || message.author.bot) return undefined;
- let Command = message.content.split(' ')[0].toLowerCase();
- let args = message.content.split(' ');
- if (Command == prefix + 'blacklist') {
- if (!settings.owners.includes (message.author.id)) return null;
- if (!args[1] || !args[2] || !args[3]) return message.reply ('Ex: '+Command+' add/remove <serverid> <reason>');
- if (!['add', 'remove'].includes (args[1].toLowerCase())) return message.channel.send ('**Invalid args 🙄.**');
- let truefalse = args[1].toLowerCase() == 'add' ? true : false;
- let nahah = truefalse ? 'blacklisted' : 'unblacklisted';
- if (truefalse && Client.guilds.get (args[2])) {
- let guild = Client.guilds.get (args[2]);
- guild.owner.send (`**Your server \`${guild.name}\` has been blacklisted for \`${args.slice(3).join(' ')}\`**`).catch (err => undefined).then(() => guild.leave());
- };
- if (!blacklists[args[2]]) {
- blacklists[args[2]] = {
- "status": truefalse,
- "reason": args.slice(3).join(' ').split('`').join('')
- };
- saveB();
- message.channel.send (`**Succesfully ${nahah} ${Client.guilds.get (args[2]) ? Client.guilds.get (args[2]).name+'.**' : 'the server.**'}`);
- } else {
- blacklists[args[2]] = {
- "status": truefalse,
- "reason": args.slice(3).join(' ').split('`').join('')
- };
- saveB();
- message.channel.send (`**Succesfully ${nahah} ${Client.guilds.get (args[2]) ? Client.guilds.get (args[2]).name+'.**' : 'the server.**'}`);
- }
- };
- if (Command == prefix+'leave') {
- if (!settings.owners.includes (message.author.id)) return null;
- if (!args [1]) return message.channel.send('**Ex: ' + Command+ ' <server name / server id>**');
- let guild = Client.guilds.get (args[1]) || Client.guilds.find (Guild => (Guild.name == args.slice(1).join(' ')) || (Guild.name.startsWith (args.slice(1).join(' '))))
- if (!guild) return message.channel.send (`**No guild found with id/name \`${args.slice(1).join(' ')}\`**`)
- this.emojis = {
- yes: '✅',
- no: '❌'
- };
- message.channel.send (`**Are You sure you want me left this server:\nName: ${guild.name}\nMembers Count: ${guild.memberCount}\nOwnerShip: ${guild.owner} (ID: ${guild.ownerID})**`).then (async (msg) => {
- await msg.react (this.emojis.yes);
- await msg.react (this.emojis.no);
- let filter = (reaction, user) => {
- return user.id == message.author.id;
- }
- let collector = await msg.createReactionCollector (filter, {time: 1000 * 15});
- collector.on ('collect', async (r) => {
- collector.stop();msg.delete().catch (err => undefined);
- switch (r.emoji.name) {
- case this.emojis.yes:
- message.channel.send ('**Successfully left the server.**').then (() => guild.leave()).catch (err => guild.leave());
- break;
- case this.emojis.no:
- message.channel.send ('**Successfully cancelled.**');
- break;
- }
- }).on ('end', () => {
- msg.delete();
- message.reply ('**Time out.**');
- })
- })
- }
- });
- client.on ('guildCreate', Guild => {
- if (blacklists [Guild.id] && blacklists[Guild.id].status == true){
- Guild.owner.send (`**You can't add me to \`${Guild.name}\` server this server is blacklisted for \`${blacklists[Guild.id].reason}\`**`).catch (err => undefined).then (() => Guild.leave());
- }
- });
- //By 3Mo_Steve | Toxic Codes
Add Comment
Please, Sign In to add comment