Discord js Collector - paging messages do not work

Asked

Viewed 133 times

1

These days I’m learning a little about developing bots, and in the process I researched pagination messages and ended up finding the discord.js collector.

On the site there were some examples ready, so I used one of them on Repl.it and worked normally. After that I switched to Vscode and when executing the command it showed the following error:

(Ode:7688) Unhandledpromiserejectionwarning: Typeerror: Cannot Convert Undefined or null to Object At Function.Keys () At function. __createReactionCollector (D: Users MYPC Desktop Bottest node_modules Discord.js-Collector src Collectors reactionCollector.js:405:34) At function.Paginator (D: Users MYPC Desktop Bottest node_modules Discord.js-Collector src Collectors reactionCollector.js:329:32) at processTicksAndRejections (Internal/process/task_queues.js:97:5) (Ode:7688) Unhandledpromiserejectionwarning: Unhandled Promise rejection. This error either originated by Throwing Inside of an async Function without a catch block, or by rejecting a Promise which was not handled with . (catch). To terminate the Node process on unhandled Promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (Ode:7688) [DEP0018] Deprecationwarning: Unhandled Promise rejections are deprecated. In the Future, Promise rejections that are not handled will terminate the Node.js process with a non-zero Exit code.

The problem with code is that emojis do not appear to change pages. At first I thought I needed to configure the emojis in the code, however, in the example there was nothing like.

I already looked in the package folder to see if there was anything that would help me, but the examples are the same or lead to github.

Could someone help me?

The code is this:

const { ReactionCollector } = require ('discord.js-collector');
const { Client, MessageEmbed } = require("discord.js");
const client = new Client()
client.on("Pronto?", () => {
    console.log("Pronto!");
});
exports.run = async (_, message) => {
      const botMessage = await message.reply('Testeteste');

        ReactionCollector.paginator({
        botMessage,
        user: message.author,
        pages: [
          new MessageEmbed()
            .setTitle('')
            .setDescription('') 
            .setImage('')
            .setFooter('')
            .setURL(''),
          new MessageEmbed()
            .setTitle('')
            .setDescription('') 
            .setImage('')
            .setFooter('')
            .setURL('')
        ],
            collectorOptions: {
              time: 350000
                    

        }
            
    });
}

The embeds aren’t empty, I just put it like this so the code doesn’t get huge.

1 answer

0

Just passing to say that I have already solved my problem. What I did was use the same version of node.js of repl.it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.