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

155
Views
Check if a member is in a certain server Discord BOT javascript

I'm trying to setup the command so that whenever the bot receives a direct message from a user, it checks whether if this user in this certain server.

I have the ID for the server, but unable to make it work.

  let serverID = "redacted"
  let checkGuild = client.guilds.cache.get(serverID)
  let checkID = msg.author.id
 if (checkGuild.members.cache.find(checkID)){
  }else{
       msg.reply("Not In Server:ERROR")
  }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use .get()

let guildID = "GUILD_ID"
let userID = "USER_ID"

let guild = client.guilds.cache.get(guildID)
let member = guild.members.cache.get(userID)
if (!member) return message.reply("He left the server")
// Will return undefined if member does not exist
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!