Changed guild to member

This commit is contained in:
loicbersier 2020-03-07 17:59:09 +01:00
parent 5aba35502b
commit 3ad46b7950

View file

@ -10,8 +10,8 @@ class guildMemberRemoveListener extends Listener {
}); });
} }
async exec(guild) { async exec(member) {
const leave = await leaveChannel.findOne({where: {guildID: guild.guild.id}}); const leave = await leaveChannel.findOne({where: {guildID: member.guild.id}});
if (leave) { if (leave) {
const channel = this.client.channels.resolve(leave.get('channelID')); const channel = this.client.channels.resolve(leave.get('channelID'));
@ -19,8 +19,8 @@ class guildMemberRemoveListener extends Listener {
let invite = new RegExp(/(https?:\/\/)?(www\.)?discord(?:app\.com|\.gg)[/invite/]?(?:(?!.*[Ii10OolL]).[a-zA-Z0-9]{5,6}|[a-zA-Z0-9-]{2,32})/g); let invite = new RegExp(/(https?:\/\/)?(www\.)?discord(?:app\.com|\.gg)[/invite/]?(?:(?!.*[Ii10OolL]).[a-zA-Z0-9]{5,6}|[a-zA-Z0-9-]{2,32})/g);
let username = guild.user.username; let username = member.user.username;
let user = guild.user; let user = member.user;
if (username.match(invite)) { if (username.match(invite)) {
username = username.replace(/(https?:\/\/)?(www\.)?discord(?:app\.com|\.gg)[/invite/]?(?:(?!.*[Ii10OolL]).[a-zA-Z0-9]{5,6}|[a-zA-Z0-9-]{2,32})/g, '[REDACTED]'); username = username.replace(/(https?:\/\/)?(www\.)?discord(?:app\.com|\.gg)[/invite/]?(?:(?!.*[Ii10OolL]).[a-zA-Z0-9]{5,6}|[a-zA-Z0-9-]{2,32})/g, '[REDACTED]');
user = username; user = username;
@ -28,7 +28,7 @@ class guildMemberRemoveListener extends Listener {
byeMessage = byeMessage.replace(/\[member\]/, username); byeMessage = byeMessage.replace(/\[member\]/, username);
byeMessage = byeMessage.replace(/\[memberPing\]/, user); byeMessage = byeMessage.replace(/\[memberPing\]/, user);
byeMessage = byeMessage.replace(/\[server\]/, guild.guild.name); byeMessage = byeMessage.replace(/\[server\]/, member.guild.name);
let attach; let attach;
if (byeMessage.includes('[attach:')) { if (byeMessage.includes('[attach:')) {