Collector Error

- Code
if (data) {
const Btns = new Discord.ActionRowBuilder()
.addComponents(
new Discord.ButtonBuilder()
.setCustomId('confirm-reset')
.setLabel('Yes')
.setStyle(Discord.ButtonStyle.Danger),
new Discord.ButtonBuilder()
.setCustomId('cancel-reset')
.setLabel('No')
.setStyle(Discord.ButtonStyle.Secondary),
)

const reply = interaction.reply({
fetchReply: true,
ephemeral: true,
embeds: [new Discord.EmbedBuilder()
.setTitle('Confirmation')
.setDescription('Are you sure you want to reset all of your points?')
.setColor('Orange')
.setFooter({ text: 'Points Tracker V3', iconURL: 'https://cdn.discordapp.com/attachments/1227294994629656667/1287822146105638922/PT_NEW.png?ex=67475156&is=6745ffd6&hm=7078051f4f0655a06d9efb13748dfd2c913c9c74864a506146cc5350752cc98b&' })
],
components: [Btns]
})

const collector = reply.createMessageComponentCollector({
componentType: Discord.ComponentType.Button,
time: 15 * 1000,
});

collector.on('collect', async(interaction) => {
if (interaction.customId === 'confirm-reset') {
data.Briefings = 0
data.Rosters = 0
data.RAs = 0
data.Trainings = 0
data.SC = 0
data.Onboardings = 0
data.Hours = 0
data.Total = 0

data.save()
reply.editReply({
ephemeral: true,
embeds: [new Discord.EmbedBuilder()
.setTitle('Reset Successful')
.setDescription('All points have been reset')
.setColor('Green')
.setFooter({ text: 'Points Tracker V3', iconURL: 'https://cdn.discordapp.com/attachments/1227294994629656667/1287822146105638922/PT_NEW.png?ex=67475156&is=6745ffd6&hm=7078051f4f0655a06d9efb13748dfd2c913c9c74864a506146cc5350752cc98b&' })
]
})
}
})
}
if (data) {
const Btns = new Discord.ActionRowBuilder()
.addComponents(
new Discord.ButtonBuilder()
.setCustomId('confirm-reset')
.setLabel('Yes')
.setStyle(Discord.ButtonStyle.Danger),
new Discord.ButtonBuilder()
.setCustomId('cancel-reset')
.setLabel('No')
.setStyle(Discord.ButtonStyle.Secondary),
)

const reply = interaction.reply({
fetchReply: true,
ephemeral: true,
embeds: [new Discord.EmbedBuilder()
.setTitle('Confirmation')
.setDescription('Are you sure you want to reset all of your points?')
.setColor('Orange')
.setFooter({ text: 'Points Tracker V3', iconURL: 'https://cdn.discordapp.com/attachments/1227294994629656667/1287822146105638922/PT_NEW.png?ex=67475156&is=6745ffd6&hm=7078051f4f0655a06d9efb13748dfd2c913c9c74864a506146cc5350752cc98b&' })
],
components: [Btns]
})

const collector = reply.createMessageComponentCollector({
componentType: Discord.ComponentType.Button,
time: 15 * 1000,
});

collector.on('collect', async(interaction) => {
if (interaction.customId === 'confirm-reset') {
data.Briefings = 0
data.Rosters = 0
data.RAs = 0
data.Trainings = 0
data.SC = 0
data.Onboardings = 0
data.Hours = 0
data.Total = 0

data.save()
reply.editReply({
ephemeral: true,
embeds: [new Discord.EmbedBuilder()
.setTitle('Reset Successful')
.setDescription('All points have been reset')
.setColor('Green')
.setFooter({ text: 'Points Tracker V3', iconURL: 'https://cdn.discordapp.com/attachments/1227294994629656667/1287822146105638922/PT_NEW.png?ex=67475156&is=6745ffd6&hm=7078051f4f0655a06d9efb13748dfd2c913c9c74864a506146cc5350752cc98b&' })
]
})
}
})
}
- Error:
node:events:493
throw er; // Unhandled 'error' event
^

TypeError: reply.createMessageComponentCollector is not a function
at Object.execute (C:\Users\alt88\OneDrive\Desktop\Coding\GSRP - Points Tracker [NEW]\modules\Other\events\Buttons\ResetAllBtn.js:53:41)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:398:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

Node.js v21.1.0
node:events:493
throw er; // Unhandled 'error' event
^

TypeError: reply.createMessageComponentCollector is not a function
at Object.execute (C:\Users\alt88\OneDrive\Desktop\Coding\GSRP - Points Tracker [NEW]\modules\Other\events\Buttons\ResetAllBtn.js:53:41)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:398:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

Node.js v21.1.0
3 Replies
d.js toolkit
d.js toolkit4w 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
Seren_Modz 21
Seren_Modz 214w ago
u need to await your interaction.reply()
T.🎄
T.🎄OP4w ago
Oh yeahhhhh Appreciate it
Want results from more Discord servers?
Add your server