Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

111
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');
}});
7 months 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.

7 months 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***');
}});
7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos