Let user opt out of join/leave event
This commit is contained in:
parent
cfad048b8e
commit
f29d721771
4 changed files with 32 additions and 0 deletions
|
@ -9,6 +9,18 @@ export default {
|
|||
async execute(guild, client) {
|
||||
const guildOwner = await client.users.fetch(guild.ownerId);
|
||||
|
||||
const isOptOut = await db.optout.findOne({ where: { userID: guildOwner.id } });
|
||||
|
||||
if (isOptOut) {
|
||||
console.log(`A guild\n${guild.memberCount} users`);
|
||||
if (statusChannel && NODE_ENV !== 'development') {
|
||||
const channel = client.channels.resolve(statusChannel);
|
||||
|
||||
channel.send({ content: `An anonymous guild just added me.\nI'm now in ${client.guilds.cache.size} servers!` });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`${guild.name}\n${guild.memberCount} users\nOwner: ${guildOwner.username}\nOwner ID: ${guild.ownerId}`);
|
||||
|
||||
const blacklist = await guildBlacklist.findOne({ where: { guildID:guild.id } });
|
||||
|
|
|
@ -9,6 +9,18 @@ export default {
|
|||
async execute(guild, client) {
|
||||
const guildOwner = await client.users.fetch(guild.ownerId);
|
||||
|
||||
const isOptOut = await db.optout.findOne({ where: { userID: guildOwner.id } });
|
||||
|
||||
if (isOptOut) {
|
||||
console.log(`***BOT KICKED***A guild\n${guild.memberCount} users\n***BOT KICKED***`);
|
||||
if (statusChannel && NODE_ENV !== 'development') {
|
||||
const channel = client.channels.resolve(statusChannel);
|
||||
|
||||
channel.send({ content: `An anonymous guild just removed me.\nI'm now in ${client.guilds.cache.size} servers!` });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`***BOT KICKED***\n${guild.name}\n${guild.memberCount} users\nOwner: ${guildOwner.username}\nOwner ID: ${guild.ownerId}\n***BOT KICKED***`);
|
||||
|
||||
const blacklist = await guildBlacklist.findOne({ where: { guildID:guild.id } });
|
||||
|
|
|
@ -4,6 +4,10 @@ import { rand } from '../../utils/rand.js';
|
|||
export default {
|
||||
name: 'guildMemberAdd',
|
||||
async execute(member, client) {
|
||||
const isOptOut = await db.optout.findOne({ where: { userID: member.user.id } });
|
||||
|
||||
if (isOptOut) return;
|
||||
|
||||
const join = await db.joinChannel.findOne({ where: { guildID: member.guild.id } });
|
||||
|
||||
if (join) {
|
||||
|
|
|
@ -4,6 +4,10 @@ import { rand } from '../../utils/rand.js';
|
|||
export default {
|
||||
name: 'guildMemberRemove',
|
||||
async execute(member, client) {
|
||||
const isOptOut = await db.optout.findOne({ where: { userID: member.user.id } });
|
||||
|
||||
if (isOptOut) return;
|
||||
|
||||
const leave = await db.leaveChannel.findOne({ where: { guildID: member.guild.id } });
|
||||
|
||||
if (leave) {
|
||||
|
|
Loading…
Reference in a new issue