lolmak
lolmak
DIAdiscord.js - Imagine a boo! 👻
Created by lolmak on 6/17/2024 in #djs-questions
Can I make a list of options for each user separately in Slash command?
For example, each user has different data:
{
"441331402856857601": [
"Orange",
"Green"
],
"929830815699984475": [
"Blue"
]
}
{
"441331402856857601": [
"Orange",
"Green"
],
"929830815699984475": [
"Blue"
]
}
Can I make it so that the options list only offers the colors that the user has?
option.setName('name')
.setDescription('choose color')
.setRequired(true)
.addChoices(
colors
)
option.setName('name')
.setDescription('choose color')
.setRequired(true)
.addChoices(
colors
)
7 replies
DIAdiscord.js - Imagine a boo! 👻
Created by lolmak on 6/12/2024 in #djs-questions
createMessageComponentCollector timeout answer
Yahallo 🕊️. I'm learning [email protected] and have encountered an unpleasant situation. The thing is that I am creating a collector on a temporary button:
const pageControl = await response.createMessageComponentCollector({
componentType: ComponentType.Button,
time: 20000,
});
const pageControl = await response.createMessageComponentCollector({
componentType: ComponentType.Button,
time: 20000,
});
It is valid for 20 seconds after which I disable it button.setDisabled(true). Everything works fine, the bot performs the action when clicked and disables the button after the time expires. I have no problems until I decide to restart the bot. After restarting, the bot simply does not manage to disable the button in time. So when I click the button after a restart, I get a Discord error that the bot is not responding. The button actions work directly from the command. In commands.js there is a handler pageControl.on('collect', async buttonInteraction => {} Main question: Is there any way to make the bot check somehow, if the user clicked on an expired button, the bot would give a message like “interaction is out of date, reuse the command”
8 replies