Skip to content

Commit 5398bae

Browse files
committed
Tune down spam deletion
* Remove "discord" as a trigger word, too common * Require at least 2 spam keywords to trigger
1 parent 066419a commit 5398bae

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/features/autodelete-spam.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ChannelHandlers } from "../types";
22
import { isStaff } from "../helpers/discord";
3+
import { simplifyString } from "../helpers/modLog";
34

4-
const spamKeywords = ["discord", "nitro", "steam", "free", "gift", "airdrop"];
5+
const spamKeywords = ["nitro", "steam", "free", "gift", "airdrop"];
56

67
const atLeastTwo = (...bools: boolean[]) => bools.filter(Boolean).length >= 2;
78

@@ -17,13 +18,14 @@ const autodelete: ChannelHandlers = {
1718
msg.content.includes(pingKeyword),
1819
);
1920

20-
const msgHasSpamKeywords = msg.content
21-
.split(" ")
22-
.some((word) => spamKeywords.includes(word.toLowerCase()));
21+
const msgWords = simplifyString(msg.content).split(" ");
22+
const msgSpamKeywords = msgWords.map((word) => spamKeywords.includes(word));
2323

2424
const msgHasLink = msg.content.includes("http");
2525

26-
if (atLeastTwo(msgHasPingKeywords, msgHasSpamKeywords, msgHasLink)) {
26+
if (
27+
atLeastTwo(msgHasPingKeywords, atLeastTwo(...msgSpamKeywords), msgHasLink)
28+
) {
2729
await msg.react("💩");
2830
}
2931
},

0 commit comments

Comments
 (0)