check if bot can interact with a specific user/role

Hello, I can't find in the docs how to check if my bot can interact with a role/user also how do I check for "public roles" i.e @here @everyone and managed roles i.e @bot @boosters
17 Replies
d.js toolkit
d.js toolkit11mo ago
- 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!
souji
souji11mo ago
what do you mean by "can interact"?
florentine
florentine11mo ago
what do you mean 'public roles' and 'managed roles'..?
souji
souji11mo ago
here is not a role at all, it's parsed as mention by the client from message content against the literal string @here
d.js docs
d.js docs11mo ago
:property: RoleManager#everyone @main The @everyone role of the guild
souji
souji11mo ago
everyone is exposed via the manager ^ and also shares the id with the guild it belongs to so role.guild.id === role.id
d.js docs
d.js docs11mo ago
:property: Role#tags @main The tags this role has
souji
souji11mo ago
managed roles are denoted by tags ^ the tags have a different shape depending on if it's a guild connection (twitch, iirc is one), the booster role, or a managed role
x0
x0OP11mo ago
By interact i mean like the bot can interact with the role i.e a role higher then it's current position.
d.js docs
d.js docs11mo ago
:property: GuildMember#manageable @main Whether the client user is above this user in the hierarchy, according to role position and guild ownership. This is a prerequisite for many moderative actions.
souji
souji11mo ago
depending on what you want to do, there are more specific getters that also include other checks like banable etc.
x0
x0OP11mo ago
Not talking about guild members I mean a specific role I'm trying to make a mute command and trying to avoid people setting it as @everyone @here <@&serverid> @boosters or bot roles etc where u can set the muted role
d.js docs
d.js docs11mo ago
:property: Role#managed @main Whether or not the role is managed by an external service :property: Role#position The position of the role in the role manager
florentine
florentine11mo ago
this shows its position in the hierarchy i believe
souji
souji11mo ago
managed should exclude a good bit of that looks like Role#manageable is not a thing, weirdly enough Role.comparePositonTo(<BotMember>.roles.highest) careful with that one, there's computed and raw positions (positions are a bit of a mess in discord)
x0
x0OP11mo ago
Thanks for ur response helped me a lot <3
souji
souji11mo ago
general note: timeouts are almost always better than custom mute role setups the issue with roles is that leaving the server will remove them, native timeouts persist
Want results from more Discord servers?
Add your server