23 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!assuming the guild's members are cached, you can use <Role>.members and map those by nickname
How do I do that
you can fetch the members with <Role>.guild.members.fetch(), then use <Role>.members.map()
Array.prototype.map()
The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.
you can map by GuildMember.nickname
What would the code look like?
explaining how you can
sure
const members = Queued1v1Role.members.map(member => member.displayName);
that doesnt work tho
what do you mean doesnt work
I get this
TypeError: Cannot read properties of undefined (reading 'map')
show how you define Queued1v1Role
const Queued1v1Role = '1135435838046621756';
thats just a string
you can get the role with <Guild>.roles.cache.get(Quebed1v1Role)
no need to fetch, theyre cached if you have the Guilds intent
I do that but it just says users: and no actual members
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
like this?
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
Sorry, here
GuildMemberManager.fetch() returns a promise, resolve it