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
- 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!what do you mean by "can interact"?
what do you mean 'public roles' and 'managed roles'..?
here is not a role at all, it's parsed as mention by the client from message content against the literal string
@here
everyone is exposed via the manager ^
and also shares the id with the guild it belongs to
so
role.guild.id === role.id
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
By interact i mean like the bot can interact with the role i.e a role higher then it's current position.
: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.depending on what you want to do, there are more specific getters that also include other checks
like banable etc.
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
: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 managerthis shows its position in the hierarchy i believe
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)Thanks for ur response helped me a lot <3
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