d->m bridge other attachments as m.file
This commit is contained in:
parent
0d9191ed5c
commit
c9c22cdf40
2 changed files with 25 additions and 3 deletions
|
@ -289,12 +289,34 @@ async function messageToEvent(message, guild, options = {}, di) {
|
||||||
size: attachment.size
|
size: attachment.size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (attachment.content_type?.startsWith("audio/")) {
|
||||||
|
return {
|
||||||
|
$type: "m.room.message",
|
||||||
|
"m.mentions": mentions,
|
||||||
|
msgtype: "m.audio",
|
||||||
|
url: await file.uploadDiscordFileToMxc(attachment.url),
|
||||||
|
external_url: attachment.url,
|
||||||
|
body: attachment.description || attachment.filename,
|
||||||
|
filename: attachment.filename,
|
||||||
|
info: {
|
||||||
|
mimetype: attachment.content_type,
|
||||||
|
size: attachment.size,
|
||||||
|
duration: attachment.duration_secs ? attachment.duration_secs * 1000 : undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
$type: "m.room.message",
|
$type: "m.room.message",
|
||||||
"m.mentions": mentions,
|
"m.mentions": mentions,
|
||||||
msgtype: "m.text",
|
msgtype: "m.file",
|
||||||
body: `Unsupported attachment:\n${JSON.stringify(attachment, null, 2)}\n${attachment.url}`
|
url: await file.uploadDiscordFileToMxc(attachment.url),
|
||||||
|
external_url: attachment.url,
|
||||||
|
body: attachment.filename,
|
||||||
|
// TODO: filename: attachment.filename and then use body as the caption
|
||||||
|
info: {
|
||||||
|
mimetype: attachment.content_type,
|
||||||
|
size: attachment.size
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
2
notes.md
2
notes.md
|
@ -3,7 +3,7 @@
|
||||||
## Known issues
|
## Known issues
|
||||||
|
|
||||||
- m->d attachments do not work
|
- m->d attachments 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
|
- m->d replying to a message that used a blockquote should avoid using the blockquote contents as the preview
|
||||||
- d->m emojis do not work at all (inline chat, single emoji size, reactions, bridged state)
|
- 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 code blocks have slightly too much spacing
|
||||||
- m->d some reactions don't work because of the variation selector
|
- m->d some reactions don't work because of the variation selector
|
||||||
|
|
Loading…
Reference in a new issue