catch up on missed d->m messages when logging in
This commit is contained in:
parent
0f20dcab6d
commit
3436759504
16 changed files with 268 additions and 16 deletions
|
@ -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
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -21,7 +21,7 @@ test("event2message: janky test", t => {
|
|||
}
|
||||
}),
|
||||
[{
|
||||
username: "cadence:cadence.moe",
|
||||
username: "cadence",
|
||||
content: "test",
|
||||
avatar_url: undefined
|
||||
}]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue