From 6342c4569b26df8f65b5df8f3adb6eefab392576 Mon Sep 17 00:00:00 2001 From: DeSqBlocki Date: Tue, 8 Sep 2026 21:12:34 +0200 Subject: [PATCH] snapshot_poker_ui_ux_fix_again_fuckmylife --- buttons/poker/cancelConfirm.js | 10 +++--- buttons/poker/cancelKeep.js | 10 +++--- utils/cookieEconomy.js | 56 ++++++++++++++++------------------ utils/crumbPoker.js | 30 ++++++++++++++++++ 4 files changed, 66 insertions(+), 40 deletions(-) diff --git a/buttons/poker/cancelConfirm.js b/buttons/poker/cancelConfirm.js index bbb55f7..83e5385 100644 --- a/buttons/poker/cancelConfirm.js +++ b/buttons/poker/cancelConfirm.js @@ -38,11 +38,11 @@ module.exports = { game ); - return interaction.editReply({ - content: "✅ Poker table cancelled. All seated players were cashed out.", - embeds: [], - components: [] - }); + try { + await interaction.deleteReply(); + } catch {} + + return; } catch (error) { return editPokerError(interaction, error); } diff --git a/buttons/poker/cancelKeep.js b/buttons/poker/cancelKeep.js index c875a9b..76f5afc 100644 --- a/buttons/poker/cancelKeep.js +++ b/buttons/poker/cancelKeep.js @@ -8,10 +8,10 @@ module.exports = { async execute(interaction) { await deferPokerReply(interaction); - return interaction.editReply({ - content: "✅ Poker table left open.", - embeds: [], - components: [] - }); + try { + await interaction.deleteReply(); + } catch {} + + return; } }; diff --git a/utils/cookieEconomy.js b/utils/cookieEconomy.js index 223e066..0d45b5f 100644 --- a/utils/cookieEconomy.js +++ b/utils/cookieEconomy.js @@ -474,39 +474,35 @@ async function clearCookieOperation( userId, operationId ) { - if ( - typeof operationId !== - "string" - || - !/^[A-Za-z0-9:_-]{1,160}$/.test( - operationId - ) - ) { - throw new Error( - "INVALID_COOKIE_OPERATION_ID" - ); - } + const cookies = + getCookieCollection(); - const { - cookies - } = - getCollections(); - - const result = - await cookies.updateOne( - { - userId - }, - { - $pull: { - appliedCookieOperations: - operationId - } + await cookies.updateOne( + { + userId + }, + { + $pull: { + appliedCookieOperations: + operationId } - ); + } + ); - return result.modifiedCount === - 1; + await cookies.updateOne( + { + userId, + appliedCookieOperations: { + $size: 0 + } + }, + { + $unset: { + appliedCookieOperations: + "" + } + } + ); } diff --git a/utils/crumbPoker.js b/utils/crumbPoker.js index 76763ad..9e7c634 100644 --- a/utils/crumbPoker.js +++ b/utils/crumbPoker.js @@ -2426,6 +2426,20 @@ function createPokerService({ ) ); + /* + * Defensive cleanup for sessions created before + * buy-in markers were cleared immediately after + * durable table membership was committed. + */ + + await clearOperationQuietly( + userId, + buyInOperationId( + gameId, + player.sessionId + ) + ); + if ( nextGame.state === "CLOSED" @@ -2532,6 +2546,14 @@ function createPokerService({ player.sessionId ) ); + + await clearOperationQuietly( + player.userId, + buyInOperationId( + gameId, + player.sessionId + ) + ); } await deleteGameQuietly( @@ -2794,6 +2816,14 @@ function createPokerService({ ) ); + await clearOperationQuietly( + player.userId, + buyInOperationId( + game.gameId, + player.sessionId + ) + ); + const remainingGame = await store.getGame( game.gameId