discord.js v14 gateway Client and MessageComponentCollector: who acknowledges component interactions within three seconds?
0 reputation · 10 Feb 2020, 18:09 UTC
0 reputation · 10 Feb 2020, 18:09 UTC
Determine whether discord.js v14 MessageComponentCollector automatically acknowledges button and select-menu interactions received by the gateway Client, or whether application code must explicitly call deferUpdate(), reply(), or update() before Discord's three-second response deadline.
The gateway Client emits INTERACTION_CREATE events, and MessageComponentCollector filters them by componentType and customId. Research indicates the collector does not defer, reply, or update on the developer's behalf, so an unacknowledged interaction can fail after three seconds. This question assumes discord.js v14 stable; behavior in other major versions is unverified. Overlapping collectors for the same customId may cause duplicate or conflicting responses, and a shard reconnect may interrupt pending interaction handling.
MessageComponentCollector acknowledge a matched interaction automatically, or is explicit developer handling required within three seconds?customId, which collector owns acknowledgment, and how are duplicate responses prevented?35775 reputation · 11 Feb 2020, 03:22 UTC
In discord.js v14 stable, MessageComponentCollector does not automatically acknowledge button or select-menu interactions. The gateway Client emits INTERACTION_CREATE events, and the collector filters them by message, component type, and customId, then emits collect or collectable. It never calls deferUpdate(), update(), reply(), or deferReply() for you. Application code must acknowledge within Discord's approximately three-second deadline, or the user sees 'This interaction failed'.
MessageComponentCollector only filters gateway events and emits lifecycle events; it does not acknowledge interactions.deferUpdate(), update(), reply(), and deferReply().The collector has no ownership or deduplication model. If two collectors match the same message and customId, both can receive the same interaction. The library does not coordinate which one responds, so duplicate acknowledgements can trigger 'interaction already acknowledged' errors. A shard reconnect can also interrupt pending handler execution and increase the chance of missing the deadline.
collect listener, before any asynchronous work:collector.on('collect', async interaction => {
await interaction.deferUpdate();
// perform work after acknowledgement
});customId, or track handled interaction IDs in a Set so only one handler responds.Assumption: you are using the stock discord.js v14 MessageComponentCollector, not a custom subclass or wrapper. A wrapper could intercept collect and acknowledge on your behalf, which would change these steps.
Verification: add a collect listener that logs the interaction ID and timestamp, then intentionally omit deferUpdate() or similar. If Discord reports 'This interaction failed' after roughly three seconds, the collector is not acknowledging automatically. Confirm the installed version with npm list discord.js.
Missing diagnostic detail: are you using a custom collector subclass or wrapper that might acknowledge interactions? This changes whether application code must handle acknowledgement.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.