Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

101
Vistas
How to make this case insensitive

I'm not sure how I can use .toLowerCase() to make my discord command case insensitive this should be simple but I'm really new to this


exports.execute = async (client, message, args) => {
  let userBalance = client.eco.fetchMoney(message.author.id);
  if (userBalance.amount < 1) return message.channel.send("Looks like you don't have the funds for that <:smallsob:922970676283977748>.");
  let item = args[0];
  
  if (!item) return message.channel.send("What do you wish to purchase");

  let hasItem = client.shop[item];
  if (!hasItem || hasItem == undefined) return message.reply("Sorry, that doesn't exist <:smallsob:922970676283977748> Jinn is currently working on this feature so sorry if it's not fully functional");

  let isBalanceEnough = (userBalance.amount >= hasItem.cost);

  if (!isBalanceEnough) return message.reply("Your balance is insufficient. You need <:daisyy:922974700144062474> "+hasItem.cost+" to buy this item.");

  let buy = client.eco.removeMoney(message.author.id, hasItem.cost);
  
  let itemStruct = {
    name: item.toLowerCase(),
    prize: hasItem.cost
  };
  
  client.db.push(`items_${message.author.id}`, itemStruct);
  return message.channel.send(`You purchased **${item}** for **<:daisyy:922974700144062474> ${hasItem.cost}**.`);
};

exports.help = {
  name: "buy",
  aliases: [],
  usage: `buy <item>`
};
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In your handler where you check for the message content in the message event

Have this done Eg:

if(message.content.toLowerCase() === cmdName) return;

about 4 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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda