d->m bridge emojis in messages

This commit is contained in:
Cadence Ember 2023-09-19 17:43:57 +12:00
parent 94c4b6a262
commit 1657de4eef
5 changed files with 104 additions and 4 deletions

View file

@ -41,8 +41,12 @@ function getDiscordParseCallbacks(message, useHTML) {
/** @param {{animated: boolean, name: string, id: string, type: "discordEmoji"}} node */
emoji: node => {
if (useHTML) {
// TODO: upload the emoji and actually use the right mxc!!
return `<img src="mxc://cadence.moe/${node.id}" data-mx-emoticon alt=":${node.name}:" title=":${node.name}:" height="24">`
const mxc = select("emoji", "mxc_url", "WHERE emoji_id = ?").pluck().get(node.id)
if (mxc) {
return `<img data-mx-emoticon height="32" src="${mxc}" title=":${node.name}:" alt=":${node.name}:">`
} else {
return `<img src="mxc://cadence.moe/${node.id}" data-mx-emoticon alt=":${node.name}:" title=":${node.name}:" height="24">`
}
} else {
return `:${node.name}:`
}