From 4011ef0387600922f69be24ef324dd42b2229b17 Mon Sep 17 00:00:00 2001 From: Cynthia Date: Fri, 2 Dec 2022 23:13:34 -0700 Subject: [PATCH] foxwells.vinboard: fix creating messages --- src/modules/foxwells.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/modules/foxwells.js b/src/modules/foxwells.js index 9a2c1e5..1788185 100644 --- a/src/modules/foxwells.js +++ b/src/modules/foxwells.js @@ -283,16 +283,24 @@ async function processReaction(msg, user, reaction) { await deleteBoardEntry(msg.id); } } else { - logger.verbose( - "vinboard", - `Updating count for "${msg.id}" (${dbEntry.count ?? 0} -> ${trueCount})` - ); if (dbEntry.board_id) { + logger.verbose( + "vinboard", + `Updating count for "${msg.id}" (${ + dbEntry.count ?? 0 + } -> ${trueCount})` + ); await webhook.editMessage( dbEntry.board_id, await createBoardMessage(msg, trueCount) ); 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 {