1
0
Fork 0

m->d move reply message preview to own line

This commit is contained in:
Cadence Ember 2023-08-27 23:25:08 +12:00
parent 1ed40bb5f4
commit 6a03c96984
4 changed files with 32 additions and 10 deletions

View file

@ -61,10 +61,10 @@ module.exports = {
formatted_body: "\u26a0 <strong>Bridged event from Discord not delivered</strong>"
+ `<br>Gateway event: ${gatewayMessage.t}`
+ `<br>${e.toString()}`
+ `<details><summary>Error trace</summary>`
+ `<pre>${stackLines.join("\n")}</pre></details>`
+ `<details><summary>Original payload</summary>`
+ `<pre>${util.inspect(gatewayMessage.d, false, 4, false)}</pre></details>`,
+ `<div><details><summary>Error trace</summary>`
+ `<pre>${stackLines.join("\n")}</pre></details></div>`
+ `<div><details><summary>Original payload</summary>`
+ `<pre>${util.inspect(gatewayMessage.d, false, 4, false)}</pre></details></div>`,
"m.mentions": {
user_ids: ["@cadence:cadence.moe"]
}

View file

@ -173,9 +173,9 @@ async function eventToMessage(event, guild, di) {
replyLine += `Ⓜ️**${senderName}**: `
}
const repliedToContent = repliedToEvent.content.formatted_body || repliedToEvent.content.body
const contentPreviewChunks = chunk(repliedToContent.replace(/.*<\/mx-reply>/, "").replace(/(?:\n|<br>)+/g, " ").replace(/<[^>]+>/g, ""), 24)
const contentPreviewChunks = chunk(repliedToContent.replace(/.*<\/mx-reply>/, "").replace(/(?:\n|<br>)+/g, " ").replace(/<[^>]+>/g, ""), 50)
const contentPreview = contentPreviewChunks.length > 1 ? contentPreviewChunks[0] + "..." : contentPreviewChunks[0]
replyLine += contentPreview + "\n"
replyLine = `> ${replyLine}\n> ${contentPreview}\n`
})()
// Handling mentions of Discord users

View file

@ -40,10 +40,10 @@ function guard(type, fn) {
formatted_body: "\u26a0 <strong>Matrix event not delivered to Discord</strong>"
+ `<br>Event type: ${type}`
+ `<br>${e.toString()}`
+ `<details><summary>Error trace</summary>`
+ `<pre>${stackLines.join("\n")}</pre></details>`
+ `<details><summary>Original payload</summary>`
+ `<pre>${util.inspect(event, false, 4, false)}</pre></details>`,
+ `<div><details><summary>Error trace</summary>`
+ `<pre>${stackLines.join("\n")}</pre></details></div>`
+ `<div><details><summary>Original payload</summary>`
+ `<pre>${util.inspect(event, false, 4, false)}</pre></details></div>`,
"m.mentions": {
user_ids: ["@cadence:cadence.moe"]
}

View file

@ -1,5 +1,27 @@
# d2m
## Known issues
- m->d attachments do not work
- m->d edits do not work
- m->d spoilers do not work
- d->m support the rest of the attachments by reading the matrix spec instead of the current approach of whitelisting mime types
- d->m emojis do not work at all (inline chat, single emoji size, reactions, bridged state)
- m->d code blocks have slightly too much spacing
- m->d some reactions don't work because of the variation selector
- <--> check whether I implemented deletions
- rooms will be set up even if the bridge does not have permission for them, then break when it restarts and tries to reach messages
- test private threads as part of this
- solution part 1: calculate the permissions to see if the bot should be able to do stuff
- solution part 2: attempt a get messages request anyway before bridging a new room, just to make sure!
- solution part 3: revisit the permissions to add newly available rooms and to close newly inaccessible rooms
- consider a way to jump to a timestamp by making up a discord snowflake. practical? helpful?
- clean up and write documentation to selfhost
- pluralkit considerations for artemis
- consider whether to use nested spaces for channel categories and threads
## Mapping
Remember that a discord message may be transformed to multiple matrix messages.
A database will be used to store the discord id to matrix event id mapping. Table columns: