67 lines
1.5 KiB
JavaScript
67 lines
1.5 KiB
JavaScript
const {
|
|
getPokerService
|
|
} = require("../../utils/crumbPoker");
|
|
|
|
const {
|
|
deferPokerReply,
|
|
editPokerError,
|
|
refreshPokerTableMessage,
|
|
buildOpenTableLink
|
|
} = require("../../utils/pokerDiscord");
|
|
|
|
|
|
module.exports = {
|
|
name:
|
|
"pokerMyTable",
|
|
|
|
async execute(
|
|
interaction
|
|
) {
|
|
await deferPokerReply(
|
|
interaction
|
|
);
|
|
|
|
try {
|
|
const game =
|
|
await getPokerService()
|
|
.getMyTable({
|
|
guildId:
|
|
interaction.guildId,
|
|
userId:
|
|
interaction.user.id
|
|
});
|
|
|
|
if (!game) {
|
|
return interaction.editReply({
|
|
content:
|
|
"❌ You are not currently seated at a Poker table.",
|
|
embeds: [],
|
|
components: []
|
|
});
|
|
}
|
|
|
|
await refreshPokerTableMessage(
|
|
interaction.client,
|
|
game
|
|
);
|
|
|
|
return interaction.editReply({
|
|
content:
|
|
"♠️ Your active Poker table:",
|
|
embeds: [],
|
|
components:
|
|
buildOpenTableLink(
|
|
game
|
|
)
|
|
});
|
|
}
|
|
|
|
catch (error) {
|
|
return editPokerError(
|
|
interaction,
|
|
error
|
|
);
|
|
}
|
|
}
|
|
};
|