#sure I ll make a thread for it so I don
1 messages · Page 1 of 1 (latest)
let counter;
const prompt = await intr.reply({
content: `click me! ${counter}`,
components: [
{
type: ComponentType.ActionRow,
components: [
{
type: ComponentType.Button,
label: 'add click',
customId: 'add',
style: ButtonStyle.Danger,
},
{
type: ComponentType.Button,
label: 'remove click',
customId: 'remove',
style: ButtonStyle.Primary,
},
],
},
],
ephemeral: true,
fetchReply: true,
});
let result;
const collector = prompt.createMessageComponentCollector({
filter: message => {
return true;
},
time: 15000,
});
collector.on('collect', async collected => {
if (collected.customId === 'add') {
await collected.update({
content: `click me! ${++counter}`,
});
} else if (collected.customId === 'remove') {
await collected.update({
content: `click me! ${--counter}`,
});
}
});
collector.on('end', async collected => {
console.log(prompt);
await prompt.edit({
content: `Timed out!`,
}); // This 404s
});```
the on 'collect' even works fine. I was confused by the callback variable on 'end' not also having an update method, so I tried to update the prompt itself.