You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Natsuki/events/guildMemberRemove.js

16 lines
891 B

const GuildData = require('../models/guild');
const Responses = require('../models/responses');
const sendResponse = require('../util/response/sendresponse');
module.exports = async (client, member) => {
let tg = await GuildData.findOne({gid: member.guild.id});
let tr = await Responses.findOne({gid: member.guild.id});
if (
tr && tr.bindings.has('leave') && tr.responses.has(tr.bindings.get('leave'))
&& tg.lch.length && member.guild.channels.cache.has(tg.lch)
&& member.guild.channels.cache.get(tg.lch).permissionsFor(client.user.id).has("SEND_MESSAGES")
&& !client.users.cache.get(member.id).bot
) {
3 years ago
try {member.guild.channels.cache.get(tg.lch).send(await sendResponse(member, member.guild.channels.cache.get(tg.lch), 'xdlol', client, tr.responses.get(tr.bindings.get('leave'))).catch(() => {})).catch(() => {});} catch {}
}
};