Resources
Answers
Examples
Sign in
Get Started
What do you want to save?
Add Code snippet
New code examples
Javascript
2021-11-15 07:27:08
checking if a user has a role in discord js
let allowedRole = message.guild.roles.find("name", "rolename"); if (message.member.roles.has(allowedRole.id) { // allowed access to command } else { // not allowed access })
Add solution
Javascript
2021-11-06 12:06:19
if member has role discord.js
let allowedRole = message.guild.roles.find("name", "rolename"); if (message.member.roles.has(allowedRole.id) { // allowed access to command } else { // not allowed access })
Add solution
Other
2021-09-29 01:45:03
check if bot has permission discord.js
let allowedRole = message.guild.roles.find("name", "rolename"); if (message.member.roles.has(allowedRole.id) { // allowed access to command } else { // not allowed access })
Add solution
Other
2021-09-10 04:07:03
dm all roles with a message
var staffID = "503409681876779032"; message.guild.members.forEach( (member) => { if(member.roles.has(staffID)) { member.send(`This is a test for our report command. DM the bot dev if you are not staff.`); } })
Add solution
Best helpers
daily
weekly
monthly
for 3 months
Nitesh
+5
Zack Marotta
+5
Syam Kumar. V
+5
Key_asdfg
+5
Hi-yi
+5
Tim Tully
+5
Pratik Deoghare
+5
Zhak Maarli
+5
Jung Wook Kim
+5
Miky
+5
Vicente olmos
+5
Moji Moji
+5
Steve Bowman
+5
Mara Rubia Roza Burger
+5
Teddy Gonzalez
+5
Sunrise Moon
+5
Prof. S.premkumar
+5
Syafiq Kamarul Azman
+5
show more
This website uses cookies to make IQCode work for you. By using this site, you agree to our
cookie policy
Welcome Back!
Sign up to unlock all of IQCode features:
Test your skills and track progress
Engage in comprehensive interactive courses
Commit to daily skill-enhancing challenges
Solve practical, real-world issues
Share your insights and learnings
Sign in
E-mail
Password
Recover lost password
Log in
Or log in with
Not registered?
Sign up takes less than a minute
Create a Free Account
Sign up to unlock all of IQCode features:
Test your skills and track progress
Engage in comprehensive interactive courses
Commit to daily skill-enhancing challenges
Solve practical, real-world issues
Share your insights and learnings
Sign up
Email
Password
Sign up for free
Or sign up with
By signing up, you agree to the
Terms and Conditions
and
Privacy Policy
. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.