Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

163
Visualizações
on message error bot.on('message', async (msg) => { if (msg.author.bot) return; await msg.replay() });

I get this error if I type something and the bot won’t send anything.

(node:1596) DeprecationWarning: The message event is deprecated. Use messageCreate instead

(Use `node --trace-deprecation ...` to show where the warning was created)

file:///C:/Users/name/Desktop/Projekte/Neo%201PG/src/bot.js:9

    await msg.replay()

              ^
TypeError: msg.replay is not a function

Code:

import { Client, Intents } from 'discord.js';
 
export const bot = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
 
bot.on('ready', () => console.log(`${bot.user.username} is online`))
bot.on('message', async (msg) => {
    if (msg.author.bot) return;
 
    await msg.replay()
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There are 3 issues here:

  • The message event has been deprecated since Discord.JS v13 as stated in the logs. You need to rename it to messageCreate.

  • You misspelt reply as replay.

  • The msg.reply() function needs a string passed as a parameter. It cannot be used with a void parameter.

Your messageCreate event should look like this:

bot.on('messageCreate', async (msg) => {
    if (msg.author.bot) return;
 
    await msg.reply('My message content!')
});
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda