Fix timestamp resolution bug

This commit is contained in:
Cadence Ember 2024-09-20 10:01:33 +12:00
commit f011cac3c5
2 changed files with 56 additions and 2 deletions

View file

@ -349,8 +349,13 @@ async function messageToEvent(message, guild, options = {}, di) {
result = `https://matrix.to/#/${roomID}/${eventID}?${via}`
} else {
const ts = dUtils.snowflakeToTimestampExact(messageID)
const {event_id} = await di.api.getEventForTimestamp(roomID, ts)
result = `https://matrix.to/#/${roomID}/${event_id}?${via}`
try {
const {event_id} = await di.api.getEventForTimestamp(roomID, ts)
result = `https://matrix.to/#/${roomID}/${event_id}?${via}`
} catch (e) {
// M_NOT_FOUND: Unable to find event from <ts> in direction Direction.FORWARDS
result = `[unknown event, timestamp resolution failed, in room: https://matrix.to/#/${roomID}?${via}]`
}
}
} else {
result = `${match[0]} [event is from another server]`