1
0
Fork 0

m->d: Improve reply preview truncation punctuation

This commit is contained in:
Cadence Ember 2024-01-10 22:46:20 +13:00
parent d0a3c3ce29
commit a67708269d

View file

@ -435,8 +435,8 @@ async function eventToMessage(event, guild, di) {
.replace(/<span [^>]*data-mx-spoiler\b[^>]*>.*?<\/span>/g, "[spoiler]") // Good enough method of removing spoiler content. (I don't want to break out the HTML parser unless I have to.) .replace(/<span [^>]*data-mx-spoiler\b[^>]*>.*?<\/span>/g, "[spoiler]") // Good enough method of removing spoiler content. (I don't want to break out the HTML parser unless I have to.)
.replace(/<[^>]+>/g, "") // Completely strip all HTML tags and formatting. .replace(/<[^>]+>/g, "") // Completely strip all HTML tags and formatting.
), 50) ), 50)
contentPreview = ":\n> " contentPreview = ":\n> " + contentPreviewChunks[0]
contentPreview += contentPreviewChunks.length > 1 ? contentPreviewChunks[0] + "..." : contentPreviewChunks[0] if (contentPreviewChunks.length > 1) contentPreview = contentPreview.replace(/[,.']$/, "") + "..."
} }
replyLine = `> ${replyLine}${contentPreview}\n` replyLine = `> ${replyLine}${contentPreview}\n`
})() })()