Second step confirmation

Im making a deposit system to deposit USD, does discordjs allow to hold slash command execution and send a panel with 2 buttons confirm and cancel before proceeding the command?
8 Replies
d.js toolkit
d.js toolkit15mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Deerlo
Deerlo15mo ago
without a need of database
Syjalo
Syjalo15mo ago
You can send an ephemeral reply with buttons and handle button interactions.
Deerlo
Deerlo15mo ago
Yep but buttons are recognized by ids, what if I make a deposit and want to say are you sure you want to deposit this amount with buttons confirm and decline, how will it know what was the deposit amount if buttons only trigger with ids? is saving message id and attaching to deposit amounts etc. the only way? im not sure if there are better ways to handle this with discordjs just what im asking is how to make button linked to specific deposit to confirm or cancel it if confirm it proceeds the deposit
Syjalo
Syjalo15mo ago
You can set the custom id like confirm-deposit:5 and split it by : when receiving the interaction
Deerlo
Deerlo15mo ago
ohh so button identification will be confirm-deposit, but can get parameters through it?
Syjalo
Syjalo15mo ago
You can pass any string to the custom id, that's why it's called custom.
Deerlo
Deerlo15mo ago
kk thanks for giving some insight