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)
"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]]});
}
}