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

137
Views
How Can I run a user command by using their ID (Ex - /ban 696053906010276010)?
let fUser = message.guild.member(message.mentions.members.first() || message.guild.members.cache.get(args[0]))

if (!fUser) 
    return message.channel.send("Please put a valid member or a user ID for me to strike").then(msg => msg.delete({ timeout: 8000 })).catch(console.error);

How can I like ban someone using their id cause currently how my user variable is setup is it only allows me to ban them by mentioning but I want to be able to ban them by ID instead the only way I can do that right now to replace "user" with their id like this <@716382720917372998>.

But I just want to put in there raw ID and it works out.

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

0

In order to ban a user by their ID you have to do the following :

const member =  message.mentions.members.first() || await message.guild.members.fetch(args[0]);

Here the member variable is an GuildMember so you can just do member.ban() to ban them.

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!