Paginationn Questions
(This might just be a common js question, if it is please just direct me to the right source and ill figure it out) In the picture is an array with a couple objects inside etc what im wanting to do is create a new field for every object but every 10 fields create a new page (new embed with continued fields like "field 11", "field 12") as I dont want it to cluttered and plus I believe there is a limit on fields in embed objects. I know this is probably a stupid question but any help is appreciated.
2 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!not sure how that object relates to your paginated embed?
you'd generally want to access
embedArray[index]
and move index forward and backward as buttons are pressed (stateless through the button custom id, or stateful by associating the message id to the currently displayed page in memory(or persistent in a db if that's necessary for your use case))
if you make that a hardcoded array of embed structures, or generate it dynamically from data pages is up to you (i'd prefer the latter)
so you'd do something like pageData[pageNumber]
returning the data you want to display and renderPage(pageData[pageNumber])
returning the embed for said page to pass to the #edit call
(just some ideas, how exactly you build that system out is up to preference and coding style)