• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

199
Vistas
(Discord Bot) I was wondering how I could make the code process all of the messages as lower case

i wanted to make it process every message as lowercase so that it would respond if someone said
Tim Nagle, Tim nagle, tim Nagle, etc.

client.on('message', (message) => {
    if(message.content.includes('tim nagle')) {
        message.reply('hello');
}});
almost 3 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You could overwrite the current messages being sent:

client.on('message', (message)=>{
  message.content = message.content?.toLowerCase();
})

Now all the message contents will be lowercased. The question mark checks if there is a message, therefore will avoid errors where you are trying to lowercase undefined.

almost 3 years ago · Juan Pablo Isaza Denunciar

0

The problem I had was where to place toLowerCase() I had also forgotten the parenthesis at the end

client.on('message', (message) => {
    if(message.content.toLowerCase().includes('tim nagle')) {
        message.reply('I want this twink ***OBLITERATED***');
}});
almost 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda