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
+79 -5
View File
@@ -40,17 +40,91 @@ module.exports = {
}
try {
const cards =
await getPokerService()
.viewCards({
const service =
getPokerService();
const [
cards,
game
] =
await Promise.all([
service.viewCards({
gameId,
userId:
interaction.user.id
});
}),
service.getTable({
gameId
})
]);
const hand =
game.data.hand;
const player =
game.data.players.find(
candidate =>
String(candidate.userId) ===
String(interaction.user.id)
);
const currentPlayer =
hand?.players?.find(
candidate =>
candidate.seat ===
hand.currentSeat
);
const isYourTurn =
Boolean(
player
&&
hand
&&
hand.currentSeat ===
player.seat
);
const communityCards =
hand?.communityCards ?? [];
const lines = [
"### 🃏 Your Cards",
`**${cards.map(cardToString).join(" ")}**`,
"",
"**Community:** " +
(communityCards.length
? communityCards
.map(cardToString)
.join(" ")
: "No community cards yet."),
""
];
if (isYourTurn) {
lines.push(
"👉 **It's YOUR TURN.**",
game.data.turnExpiresAt
? `⏱️ Auto-folds <t:${game.data.turnExpiresAt}:R>.`
: "⏱️ Your turn timer is active."
);
}
else if (currentPlayer) {
lines.push(
`Waiting for <@${currentPlayer.userId}> to act.`
);
}
else {
lines.push(
"The hand is not currently waiting on a player action."
);
}
await interaction.editReply({
content:
`🃏 Your cards: **${cards.map(cardToString).join(" ")}**`,
lines.join("\n"),
embeds: [],
components: []
});