this isn’t really an error but more of a question

How would you exactly use the presence to detect if a specific role has online members? as i am trying to make a command that pings people on that role if they are online but i don't understand how presence work
3 Replies
d.js toolkit
d.js toolkit7mo 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!
NyR
NyR7mo ago
I'd say fetch the guild members first (possibly with withPresences option), Then get the role you want and access it's member via <Role>.members, and filter all member who does not have <Member>.presence property or if <Member>.presence.status is 'offline' There maybe a better way ig, but this is what I'd do Although I'm not sure how you plan to ping the members if you do not want to ping the role, it can be spammy (and possibly API abuse) if you are going to do it separately for each active member
Sora
SoraOP7mo ago
in another server i am in with this specific command (i got inspo from it) there is a time limit per use on each command so i'd probably add that into the code to have a time limit for each time the cmmd is used
Want results from more Discord servers?
Add your server