Skip to content

Commit fd616c2

Browse files
committed
Handle spam and everyone pings differently
1 parent 936e99e commit fd616c2

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

app/discord/automod.ts

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,31 +53,14 @@ export default async (bot: Client) => {
5353
const [author] = await Promise.all([
5454
msg.guild.members.fetch(msg.author.id),
5555
]);
56+
// Skip if the post is from someone from the staff or reactor is not staff
5657
if (isStaff(author)) {
5758
return;
5859
}
5960

60-
if (getPingCount(msg.content) > 0) {
61-
msg
62-
.reply({
63-
embeds: [
64-
{
65-
title: "Tsk tsk.",
66-
description: `Please do **not** try to use \`@here\` or \`@everyone\` - there are ${msg.guild.memberCount} members in ${msg.guild.name}.`,
67-
color: "#BA0C2F",
68-
},
69-
],
70-
})
71-
.then(async (tsk) => {
72-
await sleep(15);
73-
tsk.delete();
74-
});
75-
}
76-
7761
if (isSpam(msg.content)) {
78-
// Skip if the post is from someone from the staff or reactor is not staff
79-
8062
msg.delete();
63+
8164
const warnings = await reportUser({
8265
reason: ReportReasons.spam,
8366
message: msg,
@@ -95,6 +78,22 @@ export default async (bot: Client) => {
9578
member.kick("Autokicked for spamming");
9679
modLog.send(`Automatically kicked <@${msg.author.id}> for spam`);
9780
}
81+
} else if (getPingCount(msg.content) > 0) {
82+
await reportUser({
83+
reason: ReportReasons.ping,
84+
message: msg,
85+
});
86+
const tsk = await msg.reply({
87+
embeds: [
88+
{
89+
title: "Tsk tsk.",
90+
description: `Please do **not** try to use \`@here\` or \`@everyone\` - there are ${msg.guild.memberCount} members in ${msg.guild.name}.`,
91+
color: "#BA0C2F",
92+
},
93+
],
94+
});
95+
await Promise.all([msg.delete(), sleep(15)]);
96+
await tsk.delete();
9897
}
9998
});
10099
};

app/helpers/modLog.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const enum ReportReasons {
1414
userDelete = "userDelete",
1515
mod = "mod",
1616
spam = "spam",
17+
ping = "ping",
1718
}
1819
interface Report {
1920
reason: ReportReasons;
@@ -149,6 +150,13 @@ ${postfix}`;
149150
${extra}
150151
${reportedMessage}
151152
153+
${postfix}`;
154+
155+
case ReportReasons.ping:
156+
return `${preface}, pinged everyone:
157+
${extra}
158+
${reportedMessage}
159+
152160
${postfix}`;
153161

154162
case ReportReasons.anonReport:

0 commit comments

Comments
 (0)