diff --git a/event/listeners/guildCreate.js b/event/listeners/guildCreate.js index ae4b4a6..5cd44b9 100644 --- a/event/listeners/guildCreate.js +++ b/event/listeners/guildCreate.js @@ -1,5 +1,6 @@ const { Listener } = require('discord-akairo'); const { statsChannel } = require('../../config.json'); +const userBlacklist = require('../../models').userBlacklist; class guildCreateListener extends Listener { @@ -28,7 +29,14 @@ class guildCreateListener extends Listener { .addField('Owner ID', guild.owner.id, true) .setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`) .setTimestamp(); - + + const blacklist = await userBlacklist.findOne({where: {userID:guild.owner.id}}); + + if (blacklist) { + guild.leave(); + return channel.send(`${guild.owner.user.username} (${guild.owner.id}) tried to add me to their guild while being blacklisted!\n${guild.name} (${guild.id})`); + } + channel.send({ embed: addEmbed }); } } diff --git a/event/listeners/guildDelete.js b/event/listeners/guildDelete.js index 3ce18bc..46ad26c 100644 --- a/event/listeners/guildDelete.js +++ b/event/listeners/guildDelete.js @@ -1,5 +1,6 @@ const { Listener } = require('discord-akairo'); const { statsChannel } = require('../../config.json'); +const userBlacklist = require('../../models').userBlacklist; class guildCreateListener extends Listener { @@ -31,6 +32,13 @@ class guildCreateListener extends Listener { .setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`) .setTimestamp(); + const blacklist = await userBlacklist.findOne({where: {userID:guild.owner.id}}); + + if (blacklist) { + guild.leave(); + kickEmbed.setFooter(kickEmbed.footer + ' | Left this guild because owner is blacklisted!'); + } + channel.send({ embed: kickEmbed }); } }