feat(automod): handle additional case
vi v@vt3e.cat
Sat, 11 Apr 2026 16:50:04 +0100
1 files changed,
12 insertions(+),
11 deletions(-)
jump to
M
src/automod/index.ts
→
src/automod/index.ts
@@ -21,7 +21,11 @@ ) => Promise<AutomodResult>;
export async function handleMessage(client: Client, message: Message) { if (message.author.bot || !message.guildId) return; - const automodFunctions: AutomodFunction[] = [handleSpamLinks]; + const automodFunctions: AutomodFunction[] = [handleSpamMarker]; + + if (message.author.bot || !message.guildId || !message.member) return null; + if (await hasManagerPermissions(message.member)) return null; + if (message.channel.isThread()) return null; for (const func of automodFunctions) { const result = await func(client, message);@@ -32,19 +36,16 @@ }
} } -async function handleSpamLinks( +async function handleSpamMarker( client: Client, message: Message, ): Promise<AutomodResult> { - if (message.author.bot || !message.guildId || !message.member) return null; - if (await hasManagerPermissions(message.member)) return null; - if (message.channelId === "1378529224192819250") return null; - - const { content } = message; + const { content } = message; const blacklisted = [ "discord.gg/", "discordapp.com/invite/", - "discord.com/invite/", + "discord.com/invite/", + "check my bio" ]; if (!blacklisted.some((link) => content.includes(link))) return null;@@ -56,7 +57,7 @@
const existing = pendingReports.get(message.author.id); if (!existing) { const content = [ - `<@${message.author.id}>, your message contained an invite link and was deleted to prevent phishing attempts.`, + `<@${message.author.id}>, your message contained something indicative of a compromised account or phishing attempt, so we removed it.`, "Keep in mind, we don't allow advertising other servers here.", ]; await message.reply(content.join(" "));@@ -65,7 +66,7 @@ const logChannel = await getLogChannel(client);
if (logChannel?.isSendable()) { await message.forward(logChannel); logChannel.send( - `Deleted a message from <@${message.author.id}> in <#${message.channelId}> containing a potential phishing link.`, + `Deleted a message from <@${message.author.id}> in <#${message.channelId}> containing a potential phishing marker.`, ); }@@ -106,7 +107,7 @@ const channels = Array.from(pending.channels);
const channelMentions = channels.map((c) => `<#${c}>`).join(", "); logChannel.send( - `<@${authorId}> posted links in channels: ${channelMentions}`, + `<@${authorId}> posted message in channels: ${channelMentions}`, ); const cooldownTimer = setTimeout(