Get the list of roles for a server and browse it.

Still a little question about the roles, I would like to retrieve the complete list of all the roles to browse it and retrieve the roles 1 by 1 to do manipulations on them. How could I go about it, I don't know if guild.roles.cache.find(...) will be useful for me to do this?
8 Replies
d.js toolkit
d.js toolkit•16mo ago
- 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!
🖤 • Nelson • 🖤
It is possible to browse the collection role by role, to retrieve the different role names and store them in an array?
Unknown User
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
🖤 • Nelson • 🖤
I achieved this with a forEach. I wanted to recover the roles to put them in an array to reuse them in the autocompletion of an option of a command.
Unknown User
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
🖤 • Nelson • 🖤
Thank you for the tips, I had indeed seen that it was possible to use the .map() on the Collection class of discord.js
Unknown User
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
🖤 • Nelson • 🖤
Orf ! No so I didn't know 😭 well no big deal at least I like my little system it leads me to build something
Want results from more Discord servers?
Add your server