const { getPokerService } = require("../../utils/crumbPoker"); const { deferPokerReply, editPokerError, refreshPokerTableMessage, buildOpenTableLink } = require("../../utils/pokerDiscord"); module.exports = { name: "pokerJoinSelect", async execute( interaction ) { await deferPokerReply( interaction ); const gameId = interaction.values?.[0]; if (!gameId) { return interaction.editReply({ content: "❌ No Poker table was selected.", embeds: [], components: [] }); } try { const game = await getPokerService() .joinTable({ gameId, guildId: interaction.guildId, userId: interaction.user.id }); await refreshPokerTableMessage( interaction.client, game ); return interaction.editReply({ content: `✅ Joined the Poker table for **${game.data.buyIn.toLocaleString()} Cookies**.`, embeds: [], components: buildOpenTableLink( game ) }); } catch (error) { return editPokerError( interaction, error ); } } };