Message Component Collector Issue

msg.awaitMessageComponent({
filter: (i) => i.user.id === interaction.user.id,
componentType: ComponentType.Button,
time: 60000,
})
.then(async (i) => {
console.log(2);
})
msg.awaitMessageComponent({
filter: (i) => i.user.id === interaction.user.id,
componentType: ComponentType.Button,
time: 60000,
})
.then(async (i) => {
console.log(2);
})
2 does not log when I click a button and I get the following error 5 seconds later
Unhandled Rejection at: Promise Promise {
<rejected> Error: InteractionCollectorError
at InteractionCollector.<anonymous> (C:\Users\dzold\OneDrive\Documents\CodingProjects\aerHub-v2\node_modules\discord.js\src\structures\InteractionResponse.js:37:21)
at Object.onceWrapper (node:events:628:26)
at InteractionCollector.emit (node:events:525:35)
at InteractionCollector.emit (node:domain:489:12)
at InteractionCollector.stop (C:\Users\dzold\OneDrive\Documents\CodingProjects\aerHub-v2\node_modules\discord.js\src\structures\interfaces\Collector.js:218:10)
at Timeout.<anonymous> (C:\Users\dzold\OneDrive\Documents\CodingProjects\aerHub-v2\node_modules\discord.js\src\structures\interfaces\Collector.js:96:61)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
Unhandled Rejection at: Promise Promise {
<rejected> Error: InteractionCollectorError
at InteractionCollector.<anonymous> (C:\Users\dzold\OneDrive\Documents\CodingProjects\aerHub-v2\node_modules\discord.js\src\structures\InteractionResponse.js:37:21)
at Object.onceWrapper (node:events:628:26)
at InteractionCollector.emit (node:events:525:35)
at InteractionCollector.emit (node:domain:489:12)
at InteractionCollector.stop (C:\Users\dzold\OneDrive\Documents\CodingProjects\aerHub-v2\node_modules\discord.js\src\structures\interfaces\Collector.js:218:10)
at Timeout.<anonymous> (C:\Users\dzold\OneDrive\Documents\CodingProjects\aerHub-v2\node_modules\discord.js\src\structures\interfaces\Collector.js:96:61)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
3 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
monbrey
monbrey3y ago
Can you put a catch on it too and log that
Daniel
DanielOP3y ago
Error: InteractionCollectorError
at InteractionCollector.<anonymous> (C:\Users\dzold\OneDrive\Documents\CodingProjects\aerHub-v2\node_modules\discord.js\src\structures\InteractionResponse.js:37:21)
at Object.onceWrapper (node:events:628:26)
at InteractionCollector.emit (node:events:525:35)
at InteractionCollector.emit (node:domain:489:12)
at InteractionCollector.stop (C:\Users\dzold\OneDrive\Documents\CodingProjects\aerHub-v2\node_modules\discord.js\src\structures\interfaces\Collector.js:218:10)
at Timeout.<anonymous> (C:\Users\dzold\OneDrive\Documents\CodingProjects\aerHub-v2\node_modules\discord.js\src\structures\interfaces\Collector.js:96:61)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
Error: InteractionCollectorError
at InteractionCollector.<anonymous> (C:\Users\dzold\OneDrive\Documents\CodingProjects\aerHub-v2\node_modules\discord.js\src\structures\InteractionResponse.js:37:21)
at Object.onceWrapper (node:events:628:26)
at InteractionCollector.emit (node:events:525:35)
at InteractionCollector.emit (node:domain:489:12)
at InteractionCollector.stop (C:\Users\dzold\OneDrive\Documents\CodingProjects\aerHub-v2\node_modules\discord.js\src\structures\interfaces\Collector.js:218:10)
at Timeout.<anonymous> (C:\Users\dzold\OneDrive\Documents\CodingProjects\aerHub-v2\node_modules\discord.js\src\structures\interfaces\Collector.js:96:61)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)
Thats the error it gives msg is an InteractionModalResponse which according to the docs has awaitMessageComponenent No, it's shown from the slash command Slash Command -> Modal -> Failed Button No because after the modal, it sends a message with buttons
interaction.showModal(newUserModal);
interaction
.awaitModalSubmit({ time: 180000 })
.then(async (modal) => {
let name = modal.fields.getTextInputValue("name");
let email = modal.fields.getTextInputValue("email");
console.log(name, email);
modal
.reply({
embeds: [
new EmbedBuilder()
.setTitle("Verification Process")
.setAuthor({
name: `${interaction.user.username}#${interaction.user.discriminator}`,
iconURL:
interaction.user.displayAvatarURL(),
})
.setDescription(
`Please confirm the following information is correct.`
)
.setColor("#2f3136")
.addFields([
{
name: "Name/Nickname",
value: `||${name}||`,
inline: true,
},
{
name: "Email",
value: `||${email}||`,
inline: true,
},
])
.setImage(
"https://i.imgur.com/gLT4grB.png"
),
],
components: [correctOrIncorrect],
ephemeral: true,
})
.then((msg) => {
console.log(msg);
msg.awaitMessageComponent({
filter: (i) =>
i.user.id === interaction.user.id,
componentType: ComponentType.Button,
time: 60000,
})
.then(async (i) => {
console.log(2);
interaction.showModal(newUserModal);
interaction
.awaitModalSubmit({ time: 180000 })
.then(async (modal) => {
let name = modal.fields.getTextInputValue("name");
let email = modal.fields.getTextInputValue("email");
console.log(name, email);
modal
.reply({
embeds: [
new EmbedBuilder()
.setTitle("Verification Process")
.setAuthor({
name: `${interaction.user.username}#${interaction.user.discriminator}`,
iconURL:
interaction.user.displayAvatarURL(),
})
.setDescription(
`Please confirm the following information is correct.`
)
.setColor("#2f3136")
.addFields([
{
name: "Name/Nickname",
value: `||${name}||`,
inline: true,
},
{
name: "Email",
value: `||${email}||`,
inline: true,
},
])
.setImage(
"https://i.imgur.com/gLT4grB.png"
),
],
components: [correctOrIncorrect],
ephemeral: true,
})
.then((msg) => {
console.log(msg);
msg.awaitMessageComponent({
filter: (i) =>
i.user.id === interaction.user.id,
componentType: ComponentType.Button,
time: 60000,
})
.then(async (i) => {
console.log(2);
That’s what i did…
Want results from more Discord servers?
Add your server