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

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev committed Jun 25, 2023
1 parent d0e8101 commit d5b1a72
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/commands/moderator/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,17 @@ 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!`)

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

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

data.words.push(input.toLowerCase());
await interaction.editReply({ embeds: [error], ephemeral: true });
return;
}

data.words.push(word.toLowerCase());

await data.save();

const added = new Discord.EmbedBuilder()
Expand Down Expand Up @@ -221,14 +223,17 @@ module.exports = {

filterSchema.findOne({ _id: filter }, async (err, data) => {
if(data) {
const words = word.split(",") || [word];
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!`)

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

data.words = data.words.filter(item => item !== input.toLowerCase());
await interaction.editReply({ embeds: [error], ephemeral: true });
return;
}

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

await data.save();

const removed = new Discord.EmbedBuilder()
Expand Down

0 comments on commit d5b1a72

Please sign in to comment.