Closed ghost closed 8 years ago
https://qeled.github.io/discordie/#/docs/IGuildMember?p=IGuildMember%23roles&_k=3dslqq
read the fucking docs
I know there are the docs, but since I'm completely new to both DIscordie and JS, without any examples (at least that I could find) including .roles
I am not completely sure on what to use .roles
on.
Is it directly i.e. e.message.author.roles
(it returns undefined for me) or is it something else?
Firstly it's e.message.member.roles
(member
being IGuildMember).
And "i am not completely sure on what to use .roles
on" anything related to roles really or more or less
// outputs the names of my roles.
channel.sendMessage("Your roles are: " + member.roles.map(r => r.name).join(", "));
or even
const role = member.roles.find(r => r.name === "Bot Commander");
if (role) {} // do something with the role.
else {} // it doesn't exist on him.
or
const roleID = "some role id gotten from somewhere";
if (member.hasRole(roleID)) {} // he has it!
else {} // he doesn't have it.
Also can you atleast stop making so many issues about questions that could've been answered in the discordie channel in Discord API? (Link: https://discord.gg/wsEcz)
Thank you and sorry. I didn't know they had an official discord.
How do I check the role of a specific user?
I tried
e.message.author.role
but that wasn't right. It just returnsundefined
.