Get multiple select menu values on submit

Searched around but couldn't find a solution to this. I'm essentiall building a time/date form with a submit button. (See picture). When i interact, i see the individual events come through the collector, but i'm trying to grab all values at the end when submit is pressed, and i'm having a few issues. If the user likes the default options, and just hits "Submit" how can i fetch the values from the select menus? since none have emitted an event?
No description
8 Replies
d.js toolkit
d.js toolkit15mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
phyLayer
phyLayerOP15mo ago
DJS version 14.13.0 Node version 18.17.1
/**
* asks the questions to schedule a one time event
* @param {interaction} interaction
* @returns {Date} the date of the event
*/
async function scheduleOneTime(interaction) {
const question = "Please select a time for your event"
const rows = buildTimeSelectMenu("time");
const filter = i => {
return i.user.id === interaction.user.id;
}
const response = await interaction.editReply({
content: question,
components: rows,
})
const collector = response.createMessageComponentCollector()
collector.on('collect', async i => {
console.log(JSON.stringify(i.values));
i.deferUpdate();
})
}
/**
* asks the questions to schedule a one time event
* @param {interaction} interaction
* @returns {Date} the date of the event
*/
async function scheduleOneTime(interaction) {
const question = "Please select a time for your event"
const rows = buildTimeSelectMenu("time");
const filter = i => {
return i.user.id === interaction.user.id;
}
const response = await interaction.editReply({
content: question,
components: rows,
})
const collector = response.createMessageComponentCollector()
collector.on('collect', async i => {
console.log(JSON.stringify(i.values));
i.deferUpdate();
})
}
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
phyLayer
phyLayerOP15mo ago
ok so just do change tracking?
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
phyLayer
phyLayerOP15mo ago
So store the initial default state, update that state if/when a menu changes, and then end everything on submit instead of having submit return values in some manner
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
phyLayer
phyLayerOP15mo ago
Just making sure i understood the suggestion 🙂 ok thanks, i'll give that a shot
Want results from more Discord servers?
Add your server