collector problems and error
code:-
it throws a long error in the entire collector callback saying
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(bttn1, bttn2);
const reply = await interaction.reply({
content: "Proceed Ban?",
components: [row]
})
const collector = reply.createMessageComponentCollector({ componentType: ComponentType.Button })
collector.on("collect", async (i: ButtonInteraction) => {
switch (i.customId) {
case "confirmBan": {
if (i.user.id !== interaction.user.id) {
return await i.reply({
content: "You are not permitted to use this button!",
ephemeral: true
})
}
await interaction.guild?.bans.create(user)
await i.update({
content: `Confirmed ban for ${user}\nThey are gone!`,
components: []
})
}
break;
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(bttn1, bttn2);
const reply = await interaction.reply({
content: "Proceed Ban?",
components: [row]
})
const collector = reply.createMessageComponentCollector({ componentType: ComponentType.Button })
collector.on("collect", async (i: ButtonInteraction) => {
switch (i.customId) {
case "confirmBan": {
if (i.user.id !== interaction.user.id) {
return await i.reply({
content: "You are not permitted to use this button!",
ephemeral: true
})
}
await interaction.guild?.bans.create(user)
await i.update({
content: `Confirmed ban for ${user}\nThey are gone!`,
components: []
})
}
break;
No overload matches this call.
Overload 1 of 3, '(event: "end", listener: (collected: Collection<string, ButtonInteraction<CacheType>>, reason: string) => Awaitable<void>): InteractionCollector<...>', gave the following error.
Argument of type '"collect"' is not assignable to parameter of type '"end"'.
Overload 2 of 3, '(event: "dispose" | "collect" | "ignore", listener: (interaction: ButtonInteraction<CacheType>) => Awaitable<void>): InteractionCollector<ButtonInteraction<CacheType>>', gave the following error.
No overload matches this call.
Overload 1 of 3, '(event: "end", listener: (collected: Collection<string, ButtonInteraction<CacheType>>, reason: string) => Awaitable<void>): InteractionCollector<...>', gave the following error.
Argument of type '"collect"' is not assignable to parameter of type '"end"'.
Overload 2 of 3, '(event: "dispose" | "collect" | "ignore", listener: (interaction: ButtonInteraction<CacheType>) => Awaitable<void>): InteractionCollector<ButtonInteraction<CacheType>>', gave the following error.
1 Reply
- 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!