Only use ?ts when backfilling
This commit is contained in:
parent
55da70f8fc
commit
21156446ee
2 changed files with 3 additions and 1 deletions
|
@ -38,7 +38,8 @@ async function sendMessage(message, guild) {
|
||||||
const eventWithoutType = {...event}
|
const eventWithoutType = {...event}
|
||||||
delete eventWithoutType.$type
|
delete eventWithoutType.$type
|
||||||
|
|
||||||
const eventID = await api.sendEvent(roomID, eventType, eventWithoutType, senderMxid, new Date(message.timestamp).getTime())
|
const useTimestamp = message["backfill"] ? new Date(message.timestamp).getTime() : undefined
|
||||||
|
const eventID = await api.sendEvent(roomID, eventType, eventWithoutType, senderMxid, useTimestamp)
|
||||||
db.prepare("INSERT INTO event_message (event_id, event_type, event_subtype, message_id, channel_id, part, source) VALUES (?, ?, ?, ?, ?, ?, 1)").run(eventID, eventType, event.msgtype || null, message.id, message.channel_id, eventPart) // source 1 = discord
|
db.prepare("INSERT INTO event_message (event_id, event_type, event_subtype, message_id, channel_id, part, source) VALUES (?, ?, ?, ?, ?, ?, 1)").run(eventID, eventType, event.msgtype || null, message.id, message.channel_id, eventPart) // source 1 = discord
|
||||||
|
|
||||||
eventPart = 1 // TODO: use more intelligent algorithm to determine whether primary or supporting
|
eventPart = 1 // TODO: use more intelligent algorithm to determine whether primary or supporting
|
||||||
|
|
|
@ -100,6 +100,7 @@ module.exports = {
|
||||||
const simulatedGatewayDispatchData = {
|
const simulatedGatewayDispatchData = {
|
||||||
guild_id: guild.id,
|
guild_id: guild.id,
|
||||||
mentions: [],
|
mentions: [],
|
||||||
|
backfill: true,
|
||||||
...messages[i]
|
...messages[i]
|
||||||
}
|
}
|
||||||
await module.exports.onMessageCreate(client, simulatedGatewayDispatchData)
|
await module.exports.onMessageCreate(client, simulatedGatewayDispatchData)
|
||||||
|
|
Loading…
Reference in a new issue