53 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!How can i kick all members who doesnt have any role?
node v20.5.0
djs 13.16
you'd have to filter through the guild members, check their roles and then kick them. Do this on an interval though, to not get ratelimited
how can i do this
I used to have bots, I was trying so hard, but when I took a break, I forgot.
this doesnt work
fetch the members, cache is unreliable
resolve the promise to a variable
like this?
it says undefined again
do you know how promises work?
and roles.fetch is a method
i added await
yeah thats not how promises work
reolve it to a variable
then call .map on it
in which you will have to resolve the promise roles.fetch() returns
how can i do it
really, such questions were asked to me in the past, I had a lot of bots and it was used well, but I can't remember and discord.js has also changed so if you can help me a bit, I'd appreciate it <3
i know i'm struggling but i need help right now
i dont know if you need to fetch the role though
they might be cached when fetching the members but i'm not 100% sure
oh right
.cache.get should work
i forgot GuildMemberRoleManagers dont have a fetch option, which also answers my doubt
oh right you're checking if they have any roles, then check cache.size
should be 1 if they dont have any roles
it says this now
remove the await and call m.roles.cache.size directly
okay i fixed
so how can i hick all theese members?
i have 1000+ members in my discord
does it need interval?
you will need an interval yes
how can i set this to interval
setInterval() global function
The setInterval() method, offered on the Window and Worker interfaces, repeatedly calls a function or executes a code snippet, with a fixed time delay between each call.
also
double check whether those members actually have no roles
why
am i gonna add 2 if function?
like this?
2 if
2 checking
By the way, was == required for it to detect numbers === so let me do something accordingly so that there is no problem with the bot.
oh right
wasnt sure whether that kicked members without roles or just inactive accounts
i want kick without roles
why
isn't this enough?
with interval
is interval true?
kicking no role members with 5 sec interval
Not everyone has to be a software developer.
sorry about that but thats it
prune is kicking inactive members right?
so why i am gonna use this instead of no role kicking
how can i use this
No
1) dont spoonfeed
2) that is api spam
3) qjuh gave them an answer
4) role cache wont ever be 0
.
are you telling me
Read it
Read this
And also, the 'no' should hint you
no
should'nt hint me
because the message is deleted
and i didnt write this message
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View