Skip to content
Advertisement

members map with a limit per page

how could I make a member limit on a page? for example: only 10 members would appear on the first page, and to see the second page you would have to react with ⏩

JavaScript

Advertisement

Answer

I would get the list of users as an array, then use slice to return a portion of the array. In your case I would do:

JavaScript

Now that you can get users based off of a page number, you just need a way to set it! createReactionCollector is what you’re looking for in this case. The discordjs.guide website has a great example of this that we can modify to fit our needs:

JavaScript

Now that we can get users and await reactions, we only need to put everything together. I would put the list retrieval in a seperate function that you can call easily:

JavaScript

That’s pretty much it! Obviously you’ll have to tweak this to fit your own bot, but this code should be a great starting point.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement