Support m->d redacting messages and reactions

This commit is contained in:
Cadence Ember 2023-09-25 16:26:48 +13:00
commit 8d3ac665c9
7 changed files with 74 additions and 2 deletions

View file

@ -12,6 +12,8 @@ const {discord, db, sync, as} = require("../passthrough")
const sendEvent = sync.require("./actions/send-event")
/** @type {import("./actions/add-reaction")} */
const addReaction = sync.require("./actions/add-reaction")
/** @type {import("./actions/redact")} */
const redact = sync.require("./actions/redact")
/** @type {import("./converters/utils")} */
const utils = sync.require("./converters/utils")
/** @type {import("../matrix/api")}) */
@ -101,6 +103,15 @@ async event => {
}
}))
sync.addTemporaryListener(as, "type:m.room.redaction", guard("m.room.redaction",
/**
* @param {Ty.Event.Outer_M_Room_Redaction} event it is a m.room.redaction because that's what this listener is filtering for
*/
async event => {
if (utils.eventSenderIsFromDiscord(event.sender)) return
await redact.handle(event)
}))
sync.addTemporaryListener(as, "type:m.room.avatar", guard("m.room.avatar",
/**
* @param {Ty.Event.StateOuter<Ty.Event.M_Room_Avatar>} event