Word blacklist bug fix

This commit is contained in:
CorwinDev 2022-12-24 12:44:17 +01:00
parent 38f7782f50
commit 6b9db967af
4 changed files with 4 additions and 8 deletions

View file

@ -1,5 +0,0 @@
const { Collection } = require("discord.js");
const blacklistedWords = new Collection();
module.exports = { blacklistedWords };

View file

@ -17,6 +17,7 @@ module.exports = async (client, interaction, args) => {
if(!data.Words) data.Words = [];
data.Words.push(word);
data.save();
if(!blacklistedWords.get(interaction.guild.id)) blacklistedWords.set(interaction.guild.id, [])
blacklistedWords.get(interaction.guild.id).push(word);
}
else {

View file

@ -58,7 +58,7 @@ module.exports = async (client, member) => {
})
}
else {
client.users.fetch(inviteData.inviteUser).then(async (user) => {
client.users.fetch(inviteData.User).then(async (user) => {
const channel = member.guild.channels.cache.get(channelData.Channel)

View file

@ -18,7 +18,7 @@ module.exports = async (client) => {
await Promise.all(
splittedMsg.map((content) => {
try {
if (blacklistedWords.get(message.guild.id).includes(content.toLowerCase())) deleting = true;
if (data.Words.includes(content.toLowerCase())) deleting = true;
}
catch { }
})
@ -47,7 +47,7 @@ module.exports = async (client) => {
await Promise.all(
splittedMsg.map((content) => {
try {
if (blacklistedWords.get(newMessage.guild.id).includes(content.toLowerCase())) deleting = true;
if (data.Words.includes(content.toLowerCase())) deleting = true;
}
catch { }
})