#get roles of mentionned members

1 messages · Page 1 of 1 (latest)

surreal umbra
#

you want to get the roles of both members ?

#

if this, use <member>.roles on the member objects

cold sable
#

ye

#

the array _roles

outer lodge
#

_roles is a private property, theres a .roles which is a GuildMemberRoleManager

cold sable
#

yes but when i parse mentions in message content

#

there is my code :

#
// ANTI PING STAFF
let user = message.mentions.members;
if(user) console.log(user)```
outer lodge
#

user is a collection of members

cold sable
#

ye

#

this

surreal umbra
#

You get a collection

#

Of members

outer lodge
#

collection doesnt have a .roles property

cold sable
#

yes

outer lodge
#

a GuildMember does

cold sable
#

ye but how can i parse

outer lodge
#

do you know what a collection is

surreal umbra
#

No he don’t

cold sable
#

Or when he detect mentions, how can i get only all mentions users id?

surreal umbra
#

You don’t have to "parse" a collection

outer lodge
#

use collection#map

#

or if you want only user ids, then [...members.keys()]

surreal umbra
#

Or

collection.forEach(member => {
    console.log(member.roles)
})
cold sable
#

ok i will try

#

i have this @surreal umbra

surreal umbra
cold sable
#

member._roles

surreal umbra
#

I can’t help you more, you need to know a minimum of things in discord js

#

Im not google

cold sable
#

ye i have use this and it's good

#

thx for ur help

surreal umbra
#

Nice

#

you’re welcome bro