Compare commits
No commits in common. "6df931f848d01af9f9951d3da8fdd0abdc8452fd" and "cd0b8bff2b358568fb826003193d3122751fab31" have entirely different histories.
6df931f848
...
cd0b8bff2b
2 changed files with 4 additions and 14 deletions
|
|
@ -86,19 +86,7 @@ async function sendMessage(message, channel, guild, row) {
|
||||||
|
|
||||||
const useTimestamp = message["backfill"] ? new Date(message.timestamp).getTime() : undefined
|
const useTimestamp = message["backfill"] ? new Date(message.timestamp).getTime() : undefined
|
||||||
const eventID = await api.sendEvent(roomID, eventType, eventWithoutType, senderMxid, useTimestamp)
|
const eventID = await api.sendEvent(roomID, eventType, eventWithoutType, senderMxid, useTimestamp)
|
||||||
eventIDs.push(eventID)
|
|
||||||
|
|
||||||
try {
|
|
||||||
db.prepare("INSERT INTO event_message (event_id, event_type, event_subtype, message_id, part, reaction_part, source) VALUES (?, ?, ?, ?, ?, ?, 1)").run(eventID, eventType, event.msgtype || null, message.id, part, reactionPart) // source 1 = discord
|
db.prepare("INSERT INTO event_message (event_id, event_type, event_subtype, message_id, part, reaction_part, source) VALUES (?, ?, ?, ?, ?, ?, 1)").run(eventID, eventType, event.msgtype || null, message.id, part, reactionPart) // source 1 = discord
|
||||||
} catch (e) {
|
|
||||||
// check if we got rugpulled
|
|
||||||
if (!select("message_room", "message_id", {message_id: message.id}).get()) {
|
|
||||||
for (const eventID of eventIDs) {
|
|
||||||
await api.redactEvent(roomID, eventID)
|
|
||||||
}
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 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.
|
// 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.
|
||||||
|
|
@ -135,6 +123,8 @@ async function sendMessage(message, channel, guild, row) {
|
||||||
db.prepare("INSERT INTO event_message (event_id, event_type, event_subtype, message_id, part, reaction_part, source) VALUES (?, ?, ?, ?, ?, ?, 0)").run(eventID, eventType, event.msgtype || null, sentResultsMessage.id, 1, 0)
|
db.prepare("INSERT INTO event_message (event_id, event_type, event_subtype, message_id, part, reaction_part, source) VALUES (?, ?, ?, ?, ?, ?, 0)").run(eventID, eventType, event.msgtype || null, sentResultsMessage.id, 1, 0)
|
||||||
})()
|
})()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eventIDs.push(eventID)
|
||||||
}
|
}
|
||||||
|
|
||||||
return eventIDs
|
return eventIDs
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ function checkRegistration(reg) {
|
||||||
/* c8 ignore next 4 */
|
/* c8 ignore next 4 */
|
||||||
/** @param {import("../types").AppServiceRegistrationConfig} reg */
|
/** @param {import("../types").AppServiceRegistrationConfig} reg */
|
||||||
function writeRegistration(reg) {
|
function writeRegistration(reg) {
|
||||||
fs.writeFileSync(registrationFilePath, JSON.stringify(reg, null, 2) + "\n")
|
fs.writeFileSync(registrationFilePath, JSON.stringify(reg, null, 2))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue