Fix typecheck

This commit is contained in:
Cadence Ember
2026-02-11 11:31:27 +13:00
parent 33eef25cf1
commit c4909653aa
21 changed files with 117 additions and 65 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ const retrigger = sync.require("../../d2m/actions/retrigger")
*/
async function addReaction(event) {
// Wait until the corresponding channel and message have already been bridged
if (retrigger.eventNotFoundThenRetrigger(event.content["m.relates_to"].event_id, as.emit.bind(as, "type:m.reaction", event))) return
if (retrigger.eventNotFoundThenRetrigger(event.content["m.relates_to"].event_id, () => as.emit("type:m.reaction", event))) return
// These will exist because it passed retrigger
const row = from("event_message").join("message_room", "message_id").join("historical_channel_room", "historical_room_index")
+1 -1
View File
@@ -58,7 +58,7 @@ async function handle(event) {
await removeReaction(event)
// Or, it might be for removing a message or suppressing embeds. But to do that, the message needs to be bridged first.
if (retrigger.eventNotFoundThenRetrigger(event.redacts, as.emit.bind(as, "type:m.room.redaction", event))) return
if (retrigger.eventNotFoundThenRetrigger(event.redacts, () => as.emit("type:m.room.redaction", event))) return
const row = select("event_message", ["event_type", "event_subtype", "part"], {event_id: event.redacts}).get()
if (row && row.event_type === "m.room.message" && row.event_subtype === "m.notice" && row.part === 1) {
+2
View File
@@ -1,4 +1,5 @@
// @ts-check
/// <reference lib="dom" />
const Ty = require("../../types")
const DiscordTypes = require("discord-api-types/v10")
@@ -371,6 +372,7 @@ function linkEndOfMessageSpriteSheet(content) {
for (const mxc of endOfMessageEmojis) {
// We can do up to 2000 chars max. (In this maximal case it will get chunked to a separate message.) Ignore additional emojis.
const withoutMxc = mxUtils.makeMxcPublic(mxc)
assert(withoutMxc)
const emojisLength = params.toString().length + encodeURIComponent(withoutMxc).length + 2
if (content.length + emojisLength + afterLink.length > 2000) {
break