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

298
Views
removing mentions (discord.js 12.5.3)

I need to remove a user mention from message content, but nothing works. Discord.js version: 12.5.3

var content = message.content.toLowerCase().slice(6).trim().replace(/@(everyone)/gi, "@evеryone").replace(/@(here)/gi, "@hеre");
   !message.content.trim().endsWith('-test');

   if (message.mentions.users.size) {
      const mentioned = message.mentions.users.first();
      content.replace(``, '') // here is a problem
      var form = `${content}`;
   } else {
      doSomething()
   }
message.channel.send(form);
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Its really simple actually. Discord.js has its own function for that: Util.cleanContent()

You can replace all your code with this one-liner:

message.channel.send(discord.Util.cleanContent(message.content, message))

or (as @MrMythical rightfully mentioned):

return message.reply(message.cleanContent)

The message still looks the same, just without the pings.

about 4 years ago · Juan Pablo Isaza Report

0

Try This

if(message.content.toLowerCase().includes("@")) {
message.delete()
message.reply("Do Not Ping!")
}
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!