Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

107
Views
How to make my Discord.js bot that leaves servers below a certain member count

I am making a discord.js bot and trying to get it verified! I want to make it so when you add it to a server and it has below 35 members it leaves it. This is so when I get it verified it doesn't think I am inorganically growing the bot. Is this possible?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

DJS Documentation

In order to achieve this, you need to bring together different attributes and methods.

Client: GuildCreate Event

Guild: MemberCount

Guild: Leave

Sample

Start GuildCreate Event => 
    if (guild has less than 35 members) do 
         leave guild
    endif
endfunction
client.on('guildCreate', (guild) => {
    if (guild.memberCount < 35) {
        guild.leave();
    }
})
about 4 years ago · Juan Pablo Isaza Report

0

So you can do this using a eval command on which I have done before the permissions you just need is the members intent and you can make it leave servers under the member count

client.guilds.cache.forEach(guild => {
    const memberCount = guild.members.cache.filter(member => !member.user.bot).size

// This filters out bots and only counts true members

    if (memberCount < 35) {
        guild.leave()
        console.log(`Left the ${guild.name} guild because they only had ${memberCount} members!`)
    }
})
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!