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

116
Views
How to add data to string in a message.channel.send?

My code is the following:

client.on('message',message => {
if(!message.content.startsWith(prefix) || message.author.bot) return;

const args = message.content.slice(prefix.length).split(/ + /);
const command = args.shift().toLowerCase();


for (let i = 0; i < array1.length;i++) { 
    
    if (command === array[i]) {
        message.channel.send( { embeds: ['https://www.google.com/search?q' &&array1[i]]});
    }

}

Whenever I write with the prefix in discord (or any message), I get the following error: (node:8604) DeprecationWarning: The message event is deprecated. Use messageCreate instead (Use node --trace-deprecation ... to show where the warning was created)

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

0

"message" event was for v12 of discord.js.

On v13 you should use "messageCreate" instead of "message" on your event.

Here is code example;

client.on('messageCreate',message => {
if(!message.content.startsWith(prefix) || message.author.bot) return;

const args = message.content.slice(prefix.length).split(/ + /);
const command = args.shift().toLowerCase();


for (let i = 0; i < array1.length;i++) { 
    
    if (command === array[i]) {
        message.channel.send( { embeds: ['https://www.google.com/search?q' &&array1[i]]});
    }

}

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!