m->d avoid using blockquote as reply preview

This commit is contained in:
Cadence Ember 2023-09-03 16:38:54 +12:00
parent efa0171172
commit aa263d3eb8
3 changed files with 53 additions and 5 deletions

View file

@ -210,7 +210,7 @@ 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, ""), 50)
const contentPreviewChunks = chunk(repliedToContent.replace(/.*<\/mx-reply>/, "").replace(/.*?<\/blockquote>/, "").replace(/(?:\n|<br>)+/g, " ").replace(/<[^>]+>/g, ""), 50)
const contentPreview = contentPreviewChunks.length > 1 ? contentPreviewChunks[0] + "..." : contentPreviewChunks[0]
replyLine = `> ${replyLine}\n> ${contentPreview}\n`
})()