Compare commits
3 commits
ef15c850dd
...
9fbef15ad1
Author | SHA1 | Date | |
---|---|---|---|
9fbef15ad1 | |||
a925750254 | |||
a5d170eb8f |
3 changed files with 6 additions and 5 deletions
|
@ -46,7 +46,10 @@ async function sendMessage(message, guild) {
|
|||
const eventID = await api.sendEvent(roomID, eventType, eventWithoutType, senderMxid, useTimestamp)
|
||||
db.prepare("INSERT INTO event_message (event_id, event_type, event_subtype, message_id, part, source) VALUES (?, ?, ?, ?, ?, 1)").run(eventID, eventType, event.msgtype || null, message.id, eventPart) // source 1 = discord
|
||||
|
||||
eventPart = 1 // TODO: use more intelligent algorithm to determine whether primary or supporting
|
||||
// The primary event is part = 0 and has the most important and distinct information. It is used to provide reply previews, be pinned, and possibly future uses.
|
||||
// The first event is chosen to be the primary part because it is usually the message text content and is more likely to be distinct.
|
||||
// For example, "Reply to 'this meme made me think of you'" is more useful than "Replied to image".
|
||||
eventPart = 1
|
||||
eventIDs.push(eventID)
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ async function addReaction(event) {
|
|||
const messageID = select("event_message", "message_id", {event_id: event.content["m.relates_to"].event_id, part: 0}).pluck().get() // 0 = primary
|
||||
if (!messageID) return // Nothing can be done if the parent message was never bridged.
|
||||
|
||||
const key = event.content["m.relates_to"].key // TODO: handle custom text or emoji reactions
|
||||
const key = event.content["m.relates_to"].key
|
||||
const discordPreferredEncoding = emoji.encodeEmoji(key, event.content.shortcode)
|
||||
if (!discordPreferredEncoding) return
|
||||
|
||||
|
|
|
@ -21,13 +21,11 @@ function _removeExpiryParams(url) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
* @param {string} path or full URL if it's not a Discord CDN file
|
||||
*/
|
||||
async function uploadDiscordFileToMxc(path) {
|
||||
let url
|
||||
if (path.startsWith("http")) {
|
||||
// TODO: this is cheating to make seed.js easier. due a refactor or a name change since it's not soley for discord?
|
||||
// possibly could be good to save non-discord external URLs under a user-specified key rather than simply using the url?
|
||||
url = path
|
||||
} else {
|
||||
url = DISCORD_IMAGES_BASE + path
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue