foxwells.vinboard: fix creating messages

This commit is contained in:
Cynthia Foxwell 2022-12-02 23:13:34 -07:00
parent cb00a01da3
commit 4011ef0387

View file

@ -283,16 +283,24 @@ async function processReaction(msg, user, reaction) {
await deleteBoardEntry(msg.id); await deleteBoardEntry(msg.id);
} }
} else { } else {
logger.verbose(
"vinboard",
`Updating count for "${msg.id}" (${dbEntry.count ?? 0} -> ${trueCount})`
);
if (dbEntry.board_id) { if (dbEntry.board_id) {
logger.verbose(
"vinboard",
`Updating count for "${msg.id}" (${
dbEntry.count ?? 0
} -> ${trueCount})`
);
await webhook.editMessage( await webhook.editMessage(
dbEntry.board_id, dbEntry.board_id,
await createBoardMessage(msg, trueCount) await createBoardMessage(msg, trueCount)
); );
await setBoardEntry(msg.id, trueCount, dbEntry.board_id); await setBoardEntry(msg.id, trueCount, dbEntry.board_id);
} else {
logger.verbose("vinboard", `Creating entry for "${msg.id}"`);
const boardMessage = await webhook.execute(
await createBoardMessage(msg, trueCount)
);
await setBoardEntry(msg.id, trueCount, boardMessage.id);
} }
} }
} else { } else {