snapshot_poker_phase3
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
const {
|
||||
cardToString
|
||||
} = require("../../utils/pokerEngine");
|
||||
|
||||
const {
|
||||
getPokerService
|
||||
} = require("../../utils/crumbPoker");
|
||||
|
||||
const {
|
||||
POKER_CARD_RESPONSE_LIFETIME,
|
||||
deferPokerReply,
|
||||
editPokerError,
|
||||
getPokerGameIdFromInteraction
|
||||
} = require("../../utils/pokerDiscord");
|
||||
|
||||
|
||||
module.exports = {
|
||||
name:
|
||||
"pokerCards",
|
||||
|
||||
async execute(
|
||||
interaction
|
||||
) {
|
||||
await deferPokerReply(
|
||||
interaction
|
||||
);
|
||||
|
||||
const gameId =
|
||||
getPokerGameIdFromInteraction(
|
||||
interaction
|
||||
);
|
||||
|
||||
if (!gameId) {
|
||||
return interaction.editReply({
|
||||
content:
|
||||
"❌ This Poker table is no longer active.",
|
||||
embeds: [],
|
||||
components: []
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const cards =
|
||||
await getPokerService()
|
||||
.viewCards({
|
||||
gameId,
|
||||
userId:
|
||||
interaction.user.id
|
||||
});
|
||||
|
||||
await interaction.editReply({
|
||||
content:
|
||||
`🃏 Your cards: **${cards.map(cardToString).join(" ")}**`,
|
||||
embeds: [],
|
||||
components: []
|
||||
});
|
||||
|
||||
setTimeout(
|
||||
() => {
|
||||
interaction
|
||||
.deleteReply()
|
||||
.catch(() => {});
|
||||
},
|
||||
POKER_CARD_RESPONSE_LIFETIME
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
catch (error) {
|
||||
return editPokerError(
|
||||
interaction,
|
||||
error
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user