fix log line

This commit is contained in:
Will Hunt 2024-09-19 15:55:53 +01:00
parent 02de47e83f
commit fa9a17cf44

View File

@ -75,12 +75,12 @@ export class MentionSpam extends Protection {
const explicitMentions = content["m.mentions"]?.["m.user_ids"]; const explicitMentions = content["m.mentions"]?.["m.user_ids"];
const hitLimit = this.checkMentions(content.body, content.formatted_body, explicitMentions); const hitLimit = this.checkMentions(content.body, content.formatted_body, explicitMentions);
if (hitLimit) { if (hitLimit) {
await mjolnir.managementRoomOutput.logMessage(LogLevel.WARN, "MessageIsMedia", `Redacting event from ${event['sender']} for spamming mentions. ${Permalinks.forEvent(roomId, event['event_id'], [new UserID(await mjolnir.client.getUserId()).domain])}`); await mjolnir.managementRoomOutput.logMessage(LogLevel.WARN, "MentionSpam", `Redacting event from ${event['sender']} for spamming mentions. ${Permalinks.forEvent(roomId, event['event_id'], [new UserID(await mjolnir.client.getUserId()).domain])}`);
// Redact the event // Redact the event
if (!mjolnir.config.noop) { if (!mjolnir.config.noop) {
await mjolnir.client.redactEvent(roomId, event['event_id'], "Message was detected as spam."); await mjolnir.client.redactEvent(roomId, event['event_id'], "Message was detected as spam.");
} else { } else {
await mjolnir.managementRoomOutput.logMessage(LogLevel.WARN, "MessageIsMedia", `Tried to redact ${event['event_id']} in ${roomId} but Mjolnir is running in no-op mode`, roomId); await mjolnir.managementRoomOutput.logMessage(LogLevel.WARN, "MentionSpam", `Tried to redact ${event['event_id']} in ${roomId} but Mjolnir is running in no-op mode`, roomId);
} }
} }
} }