forked from Supositware/Haha-Yes
leave guild if owner is blacklisted
This commit is contained in:
parent
745f26c174
commit
73da34c857
2 changed files with 17 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
const { Listener } = require('discord-akairo');
|
||||
const { statsChannel } = require('../../config.json');
|
||||
const userBlacklist = require('../../models').userBlacklist;
|
||||
|
||||
|
||||
class guildCreateListener extends Listener {
|
||||
|
@ -29,6 +30,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();
|
||||
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 });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue