V
V
Vadim Ushakov2021-11-21 22:59:33
Node.js
Vadim Ushakov, 2021-11-21 22:59:33

Creating multiple message handlers in discord.js!?

There is a code snippet that creates active message handlers.

const collector = interaction.channel.createMessageComponentCollector({filter, time: o.constructor.InteractionTimeOut });

        o.collector =  collector ;

        collector.on('collect', async i => {
            if (!interaction_ids.includes(i.customId))
                return;
            else
                collector.resetTimer();

            o .___last__interacted = i;
    
            if (true === await o .on_interaction(i))
            {
                o.update_last__interacted();
            }
        } );

        collector.on('end', collected => {


When creating several such message handlers, an error occurs

D:\workspace\upwork.discord.js\node_modules\discord.js\src\rest\RequestHandler.js:349
      throw new DiscordAPIError(data, res.status, request);
            ^

DiscordAPIError: Unknown interaction
    at RequestHandler.execute (D:\workspace\upwork.discord.js\node_modules\discord.js\src\rest\RequestHandler.js:349:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (D:\workspace\upwork.discord.js\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
    at async SelectMenuInteraction.update (D:\workspace\upwork.discord.js\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:210:5) {
  method: 'post',
  path: '/interactions/912059546166513694/aW50ZXJhY3Rpb246OTEyMDU5NTQ2MTY2NTEzNjk0OlFWSGxmUUpyZXBRcU9FTXNXNWM5VjFmMjAwQmlLUHNkQXJ3M3dtWkNYVUVtTFlZWktLYVdTV3FxNWdHWnF5YTY3QTBXdGhKNTh2ZE9xQ2xtMTNmU01mVVVPbDlLTWYxelBKanBsT0pmRWhOVzBMMkgzSnZpYThqdlJlNllDNXpN/callback',       
  code: 10062,
  httpStatus: 404,
  requestData: {


Are there other options besides proxying multiple objects through a single handler?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question