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 { Listener } = require('discord-akairo');
|
||||||
const { statsChannel } = require('../../config.json');
|
const { statsChannel } = require('../../config.json');
|
||||||
|
const userBlacklist = require('../../models').userBlacklist;
|
||||||
|
|
||||||
|
|
||||||
class guildCreateListener extends Listener {
|
class guildCreateListener extends Listener {
|
||||||
|
@ -28,7 +29,14 @@ class guildCreateListener extends Listener {
|
||||||
.addField('Owner ID', guild.owner.id, true)
|
.addField('Owner ID', guild.owner.id, true)
|
||||||
.setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`)
|
.setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`)
|
||||||
.setTimestamp();
|
.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 });
|
channel.send({ embed: addEmbed });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const { Listener } = require('discord-akairo');
|
const { Listener } = require('discord-akairo');
|
||||||
const { statsChannel } = require('../../config.json');
|
const { statsChannel } = require('../../config.json');
|
||||||
|
const userBlacklist = require('../../models').userBlacklist;
|
||||||
|
|
||||||
|
|
||||||
class guildCreateListener extends Listener {
|
class guildCreateListener extends Listener {
|
||||||
|
@ -31,6 +32,13 @@ class guildCreateListener extends Listener {
|
||||||
.setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`)
|
.setFooter(`I'm now in ${this.client.guilds.cache.size} servers!`)
|
||||||
.setTimestamp();
|
.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 });
|
channel.send({ embed: kickEmbed });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue