Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev committed Jun 25, 2023
1 parent 82e27a4 commit e0034cf
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions src/commands/moderator/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,12 @@ module.exports = {

filterSchema.findOne({ _id: filter }, async (err, data) => {
if(data) {
if(data.words.includes(word.toLowerCase())) {
const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
.setDescription(`${emoji.error} That word is already on the filter!`)

await interaction.editReply({ embeds: [error], ephemeral: true });
return;
}

const words = string.split(",") || [word];

for(const input of words) {
if(data.words.includes(input.toLowerCase())) continue;

data.words.push(input.toLowerCase());
}

Expand Down Expand Up @@ -227,18 +221,11 @@ module.exports = {

filterSchema.findOne({ _id: filter }, async (err, data) => {
if(data) {
if(!data.words.includes(word.toLowerCase())) {
const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
.setDescription(`${emoji.error} That word is not on the filter!`)

await interaction.editReply({ embeds: [error], ephemeral: true });
return;
}

const words = string.split(",") || [word];

for(const input of words) {
if(!data.words.includes(word.toLowerCase())) continue;

data.words = data.words.filter(item => item !== input.toLowerCase());
}

Expand Down

0 comments on commit e0034cf

Please sign in to comment.