Detect stickers as media

This commit is contained in:
Rasmus Rendal 2023-05-11 13:34:18 +02:00
parent 9023c78e66
commit 57af0563ba
No known key found for this signature in database
GPG Key ID: 56E1E741BDFC2A8E

View File

@ -38,7 +38,7 @@ export class MessageIsMedia extends Protection {
const content = event['content'] || {}; const content = event['content'] || {};
const msgtype = content['msgtype'] || 'm.text'; const msgtype = content['msgtype'] || 'm.text';
const formattedBody = content['formatted_body'] || ''; const formattedBody = content['formatted_body'] || '';
const isMedia = msgtype === 'm.image' || msgtype === 'm.video' || formattedBody.toLowerCase().includes('<img'); const isMedia = msgtype === 'm.image' || msgtype === 'm.video' || msgtype === 'm.sticker' || formattedBody.toLowerCase().includes('<img');
if (isMedia) { if (isMedia) {
await mjolnir.managementRoomOutput.logMessage(LogLevel.WARN, "MessageIsMedia", `Redacting event from ${event['sender']} for posting an image/video. ${Permalinks.forEvent(roomId, event['event_id'], [new UserID(await mjolnir.client.getUserId()).domain])}`); await mjolnir.managementRoomOutput.logMessage(LogLevel.WARN, "MessageIsMedia", `Redacting event from ${event['sender']} for posting an image/video. ${Permalinks.forEvent(roomId, event['event_id'], [new UserID(await mjolnir.client.getUserId()).domain])}`);
// Redact the event // Redact the event