1
0
Fork 0

attempt to support THREAD_CREATE but it explodes

This commit is contained in:
Cadence Ember 2023-08-21 08:07:05 +12:00
parent 08d3f3d804
commit d666c0aedb
4 changed files with 38 additions and 5 deletions

View file

@ -27,11 +27,13 @@ function getDiscordParseCallbacks(message, useHTML) {
},
/** @param {{id: string, type: "discordChannel"}} node */
channel: node => {
const {room_id, name, nick} = db.prepare("SELECT room_id, name, nick FROM channel_room WHERE channel_id = ?").get(node.id)
if (room_id && useHTML) {
return `<a href="https://matrix.to/#/${room_id}">#${nick || name}</a>`
const row = db.prepare("SELECT room_id, name, nick FROM channel_room WHERE channel_id = ?").get(node.id)
if (!row) {
return `<#${node.id}>` // fallback for when this channel is not bridged
} else if (useHTML) {
return `<a href="https://matrix.to/#/${row.room_id}">#${row.nick || row.name}</a>`
} else {
return `#${nick || name}`
return `#${row.nick || row.name}`
}
},
/** @param {{animated: boolean, name: string, id: string, type: "discordEmoji"}} node */