From a5d170eb8fa53b6f96f66e03d69113e9d4f831f1 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Fri, 6 Oct 2023 16:58:18 +1300 Subject: [PATCH] Choosing first event as primary part = 0 is fine --- d2m/actions/send-message.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/d2m/actions/send-message.js b/d2m/actions/send-message.js index 9befbf6..ab5b6c6 100644 --- a/d2m/actions/send-message.js +++ b/d2m/actions/send-message.js @@ -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) }