1
0
Fork 0

WIP add via parameters

This commit is contained in:
Cadence Ember 2024-02-12 23:07:55 +13:00
parent 4286829b42
commit a9f57fc252
6 changed files with 65 additions and 27 deletions

View file

@ -50,8 +50,7 @@ async function doSpeedbump(messageID) {
async function maybeDoSpeedbump(channelID, messageID) {
let row = select("channel_room", ["thread_parent", "speedbump_id", "speedbump_webhook_id"], {channel_id: channelID}).get()
if (row?.thread_parent) row = select("channel_room", ["thread_parent", "speedbump_id", "speedbump_webhook_id"], {channel_id: row.thread_parent}).get() // webhooks belong to the channel, not the thread
if (!row) return {affected: false, row: null}// not affected, no speedbump
// Edits need to go through the speedbump as well. If the message is delayed but the edit isn't, we don't have anything to edit from.
if (!row?.speedbump_webhook_id) return {affected: false, row: null} // not affected, no speedbump
const affected = await doSpeedbump(messageID)
return {affected, row} // maybe affected, and there is a speedbump
}