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

Commit

Permalink
fix: check for multiple words (#552)
Browse files Browse the repository at this point in the history
* fix: check for multiple words

* refactor: removed unnecessary if
  • Loading branch information
Cahllagerfeld authored Jun 3, 2021
1 parent 5542b45 commit b631b58
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/alexjs/alex.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,19 @@ export class AlexService {
return message.channel.send(embed);
}

if (!alexMatch.length) {
const eddiehubMatch = preventWords.find((word) =>
messageText.toLowerCase().includes(word),
);

if (eddiehubMatch) {
const embed = defaultEmbed(config.colors.alerts)
.setTitle(`You used the word "${eddiehubMatch}"`)
.setDescription('This might not be inclusive or welcoming language');
const splitMessage = messageText.split(' ');

return message.channel.send(embed);
}
if (!alexMatch.length) {
splitMessage.forEach((word) => {
if (preventWords.includes(word.toLocaleLowerCase())) {
const embed = defaultEmbed(config.colors.alerts)
.setTitle(`You used the word "${word}"`)
.setDescription(
'This might not be inclusive or welcoming language',
);
return message.channel.send(embed);
}
});
}

return;
Expand Down

0 comments on commit b631b58

Please sign in to comment.