Development (#80)

- fixed string testing
- removed unnecesary nullish-coallesing
pull/89/head
Skyler 3 years ago committed by GitHub
commit 9a1c3eb99c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -268,7 +268,7 @@ export async function callback(_client: NucleusClient, message: Message) {
const check = TestString(
content,
config.filters.wordFilter.words.loose,
config.filters.wordFilter.words.strict
config.filters.wordFilter.words.strict,
);
if (check !== null) {
messageException(message.guild.id, message.channel.id, message.id);

@ -179,7 +179,7 @@ export function TestString(
string: string,
soft: string[],
strict: string[],
enabled?: boolean
enabled: boolean = true
): { word: string; type: string } | null {
if (!enabled) return null;
for (const word of strict) {
@ -220,7 +220,7 @@ export async function doMemberChecks(member: Discord.GuildMember): Promise<void>
// Does the nickname contain filtered words
let nameCheck;
if (member.nickname) {
nameCheck = TestString(member.nickname ?? "", loose, strict, guildData.filters.wordFilter.enabled);
nameCheck = TestString(member.nickname, loose, strict, guildData.filters.wordFilter.enabled);
} else {
nameCheck = TestString(member.user.username, loose, strict, guildData.filters.wordFilter.enabled);
}

Loading…
Cancel
Save