I have a question
I have a Mute and Unmute command.
I would like to know if there is a way to list all Timeout members of a server?
If so, how can I do it?
Thanks
20 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!You'd need to fetch all the members and then filter the collection
GuildMemberManager#fetch()
Fetches member(s) from a GuildMember#isCommunicationDisabled()
Whether this member is currently timed out
I did it like this, is it good ?
If it does what you want, sure
I want to list the users who are mute on my server
And does what you have there do that?
I think that currently it allows to list the users who are not mute ??
No, <GuildMember>.isCommunicationDisabled() returns true if they are timed out, your console log text is wrong
Oh yes, sorry that's me...
How can I make a map to make a list?
<Collection>.map() exists
That's it, I did it 🙂
Awesome!
I have one last question, to get the reason, how could I do it?
I made this but it doesn't work, it tells me all users mute but not the reasons.
You have to fetch audit logs to get the reason a member was muted
There is no "
communicationDisabledReason
" property or similarOkay, but then I don't know how to go about it...
MemberUpdate ?
Indeed
Okay, I did it 🙂