Compare commits

...

6 commits

View file

@ -8,6 +8,7 @@ const util = require("util")
const Ty = require("../types")
const {discord, db, sync, as, select} = require("../passthrough")
const {tag} = require("@cloudrac3r/html-template-tag")
const {Semaphore} = require("@chriscdn/promise-semaphore")
/** @type {import("./actions/send-event")} */
const sendEvent = sync.require("./actions/send-event")
@ -153,11 +154,14 @@ function guard(type, fn) {
}
}
const errorRetrySema = new Semaphore()
/**
* @param {Ty.Event.Outer<Ty.Event.M_Reaction>} reactionEvent
*/
async function onRetryReactionAdd(reactionEvent) {
const roomID = reactionEvent.room_id
errorRetrySema.request(async () => {
const event = await api.getEvent(roomID, reactionEvent.content["m.relates_to"]?.event_id)
// Check that it's a real error from OOYE
@ -181,6 +185,7 @@ async function onRetryReactionAdd(reactionEvent) {
// Redact the error to stop people from executing multiple retries
await api.redactEvent(roomID, event.event_id)
}, roomID)
}
sync.addTemporaryListener(as, "type:m.room.message", guard("m.room.message",