snapshot_poker_uiux_cleanup

This commit is contained in:
DeSqBlocki
2026-09-08 20:51:58 +02:00
parent 136a5902c0
commit 82cef1b34a
5 changed files with 154 additions and 31 deletions
+22 -3
View File
@@ -30,16 +30,16 @@ const POKER_MAX_PLAYERS =
6;
const POKER_DEFAULT_SMALL_BLIND =
100;
10;
const POKER_DEFAULT_BIG_BLIND =
200;
20;
const POKER_DEFAULT_BUY_IN =
1000;
const POKER_TURN_TIMEOUT =
30;
90;
const POKER_LOBBY_TIMEOUT =
15 * 60;
@@ -492,6 +492,17 @@ function syncCompletedHand(
game.data.turnExpiresAt =
null;
/*
* A completed hand starts a fresh between-hand lobby
* window. Do not inherit the original table-creation
* expiry, otherwise a healthy table can close shortly
* after a long hand finishes.
*/
game.data.lobbyExpiresAt =
now +
POKER_LOBBY_TIMEOUT;
return true;
}
@@ -1707,6 +1718,14 @@ function createPokerService({
nextGame.data.handCompletedAt =
null;
/*
* Lobby expiry only applies while waiting between
* hands. Active hands are governed by turn timers.
*/
nextGame.data.lobbyExpiresAt =
null;
applyTurnDeadline(
nextGame,
now(),
+19 -17
View File
@@ -115,12 +115,12 @@ function buildMainMenuEmbed(
"### 🎡 Roulette",
"Bet on Red, Black, Odd, Even, or Zero.",
"",
"### 🏦 Vault Heist",
"Attempt to breach ShaiBot's Cookie Vault.",
"",
"### ♠️ Poker",
"Create or join a 2–6 player Cookie Poker table.",
"",
"### 🏦 Vault Heist",
"Attempt to breach ShaiBot's Cookie Vault.",
"",
"### 🛟 Bankruptcy",
"At exactly 0 Cookies, claim a 1,000 Cookie starter kit."
].join("\n")
@@ -184,19 +184,6 @@ function buildMainMenuButtons() {
ButtonStyle.Primary
),
new ButtonBuilder()
.setCustomId(
"crumbSaucerHeist"
)
.setLabel(
"Vault Heist"
)
.setEmoji(
"🏦"
)
.setStyle(
ButtonStyle.Danger
),
new ButtonBuilder()
.setCustomId(
@@ -209,7 +196,22 @@ function buildMainMenuButtons() {
"♠️"
)
.setStyle(
ButtonStyle.Success
ButtonStyle.Primary
),
new ButtonBuilder()
.setCustomId(
"crumbSaucerHeist"
)
.setLabel(
"Vault Heist"
)
.setEmoji(
"🏦"
)
.setStyle(
ButtonStyle.Danger
)
),
+33 -5
View File
@@ -27,6 +27,14 @@ const POKER_TABLE_FOOTER_PREFIX =
const POKER_CARD_RESPONSE_LIFETIME =
5000;
const POKER_ACTIVE_STATES_FOR_DISPLAY =
new Set([
"PREFLOP",
"FLOP",
"TURN",
"RIVER"
]);
function getPokerGameIdFromInteraction(
interaction
@@ -509,14 +517,26 @@ function buildPokerTableEmbed(
);
const stateLabel =
publicGame.state
.replaceAll("_", " ");
publicGame.state ===
"NEXT_HAND"
? "🏆 HAND COMPLETE"
: POKER_ACTIVE_STATES_FOR_DISPLAY.has(
publicGame.state
)
? `🃏 ${publicGame.state.replaceAll("_", " ")}`
: publicGame.state
.replaceAll("_", " ");
const pot =
hand?.pot ?? 0;
const description = [
`**State:** ${stateLabel}`,
hand && POKER_ACTIVE_STATES_FOR_DISPLAY.has(
publicGame.state
)
? `**Hand #${publicGame.data.handNumber}** • 🃏 Cards have been dealt. Use **Cards** to view your hand.`
: null,
`**Blinds:** ${publicGame.data.smallBlind.toLocaleString()} / ${publicGame.data.bigBlind.toLocaleString()} 🍪`,
`**Buy-In:** ${publicGame.data.buyIn.toLocaleString()} 🍪`,
`**Pot:** ${pot.toLocaleString()} 🍪`,
@@ -547,16 +567,21 @@ function buildPokerTableEmbed(
if (current) {
description.push(
"",
`### <@${current.userId}>'s turn`
"━━━━━━━━━━━━━━━━━━",
`### 👉 CURRENT TURN: <@${current.userId}>`
);
if (
publicGame.data.turnExpiresAt
) {
description.push(
`⏱️ Auto-folds <t:${publicGame.data.turnExpiresAt}:R>`
`⏱️ **90-second turn** • Auto-folds <t:${publicGame.data.turnExpiresAt}:R>`
);
}
description.push(
"━━━━━━━━━━━━━━━━━━"
);
}
}
@@ -575,7 +600,10 @@ function buildPokerTableEmbed(
if (
publicGame.state ===
"WAITING"
"WAITING"
||
publicGame.state ===
"NEXT_HAND"
) {
description.push(
"",