Reputation: 13
So my bot DinoCord has Economy features and I want to lower cooldowns for a specific role ("Premium"). The thing is I don't know how to check if a user has a role across all servers.
Currently we use this if
(!message.member.roles.some(role => role.id === "678114167902830610"))
but that only checks in our support server where the role is at, and nowhere else. So my question is is there a way to check if a user has a role from my support server in all other servers?
Here is a gif of it.
Upvotes: 1
Views: 1924
Reputation: 14078
For Discord.js v11 (which is what you seem to be using):
// your support server
const supportGuild = client.guilds.get('673691776317390868')
const member = supportGuild.members.get(message.author.id)
const hasPremium = member ? member.roles.get('678114167902830610') : false
For v12 and v13:
// your support server
const supportGuild = client.guilds.cache.get('673691776317390868')
const member = supportGuild.members.cache.get(message.author.id)
const hasPremium = member ? member.roles.cache.get('678114167902830610') : false
Upvotes: 1