forked from cadence/out-of-your-element
Why did I make it this way??? #13
1 changed files with 6 additions and 4 deletions
|
|
@ -24,12 +24,15 @@ async function threadToAnnouncement(parentRoomID, threadRoomID, creatorMxid, thr
|
|||
/** @type {{"m.mentions"?: any, "m.relates_to"?: {event_id?: string, is_falling_back?: boolean, "m.in_reply_to"?: {event_id: string}, rel_type?: "m.replace"|"m.thread"}}} */
|
||||
const context = {}
|
||||
let suffix = "";
|
||||
if (branchedFromEventID && !ellieMode) {
|
||||
if (branchedFromEventID) {
|
||||
// Need to figure out who sent that event...
|
||||
const event = await di.api.getEvent(parentRoomID, branchedFromEventID)
|
||||
suffix = "\n[Note: You really should continue the conversation in that room, rather than in this Matrix thread. Any messages sent here will be DELETED and instead moved there by the bot, which makes it the author and strips you from control (edits/deletions) over your own message!]";
|
||||
context["m.relates_to"] = {"m.in_reply_to": {event_id: event.event_id}, is_falling_back:false, event_id: event.event_id, rel_type: "m.thread"}
|
||||
if (event.sender && !userRegex.some(rx => event.sender.match(rx))) context["m.mentions"] = {user_ids: [event.sender]}
|
||||
if (!ellieMode){
|
||||
//...And actually branch from that event (if configured to do so)
|
||||
suffix = "\n[Note: You really should continue the conversation in that room, rather than in this Matrix thread. Any messages sent here will be DELETED and instead moved there by the bot, which makes it the author and strips you from control (edits/deletions) over your own message!]";
|
||||
context["m.relates_to"] = {"m.in_reply_to": {event_id: event.event_id}, is_falling_back:false, event_id: event.event_id, rel_type: "m.thread"}
|
||||
}
|
||||
}
|
||||
|
||||
const msgtype = creatorMxid ? "m.emote" : "m.text"
|
||||
|
|
@ -40,7 +43,6 @@ async function threadToAnnouncement(parentRoomID, threadRoomID, creatorMxid, thr
|
|||
return {
|
||||
msgtype,
|
||||
body,
|
||||
"m.mentions": {},
|
||||
...context
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue