1
0
Fork 0

catch up on missed d->m messages when logging in

This commit is contained in:
Cadence Ember 2023-08-19 22:54:23 +12:00
parent 0f20dcab6d
commit 3436759504
16 changed files with 268 additions and 16 deletions

View file

@ -41,9 +41,8 @@ async function ensureWebhook(channelID, forceCreate = false) {
async function withWebhook(channelID, callback) {
const webhook = await ensureWebhook(channelID, false)
return callback(webhook).catch(e => {
console.error(e)
// TODO: check if the error was webhook-related and if webhook.created === false, then: const webhook = ensureWebhook(channelID, true); return callback(webhook)
throw new Error(e)
throw e
})
}

View file

@ -30,6 +30,12 @@ function eventToMessage(event) {
username: displayName,
avatar_url: avatarURL
})
} else if (event.content.msgtype === "m.emote") {
messages.push({
content: `*${displayName} ${event.content.body}*`,
username: displayName,
avatar_url: avatarURL
})
}
return messages

View file

@ -21,7 +21,7 @@ test("event2message: janky test", t => {
}
}),
[{
username: "cadence:cadence.moe",
username: "cadence",
content: "test",
avatar_url: undefined
}]