0

so i'm new making discord bot, and i make to reply our massage, but how to make it to detect uppercase and lower case ? please help me. im from indonesian so if my languange is bad or confuse you forgive me im making a bot its name is ToxicBot

const Discord = require("discord.js");
const client = new Discord.Client();

client.once("ready", () => {
  console.log("berhasil bos");
});

client.on("message", async massage => {
  
  if (massage.content === "gelud") {
      massage.channel.send("kuy gelud dimana ? gua support make bambu");
  } 
  if (massage.content === "pantek") {
      massage.channel.send("lu yang pantek");
  }
  if (massage.content === "anak papah kerja bagus") {
      massage.channel.send("lu bukan papah gua, gua anak haram");
  }
  if (massage.content === "tolol") {
      massage.channel.send("Iya Dia Tolol");
  }
  if (massage.content === "halo") {
      massage.channel.send("Apaan Nyari Gua, tolol");
  }
  if (massage.content === "sepi") {
       massage.channel.send("sini sama gua dari pada sama mantan");
  }
  if (massage.content === "bot tolol") {
      massage.channel.send(" he asuu ");
  }
  if (massage.content === "bot asu") {
      massage.channel.send(" he asuu ");
  }
  if (massage.content === "bot pantek") {
      massage.channel.send(" he asuu ");
  }
  if (massage.content === "test") {
      massage.channel.send(" aman ");
  }
}),


client.login("My Token");
  • 5
    Does this answer your question? [How to do case insensitive string comparison?](https://stackoverflow.com/questions/2140627/how-to-do-case-insensitive-string-comparison) – JeffUK Jul 31 '20 at 14:56

1 Answers1

0

You could just change the written message to lowercase

Just add

var content = message.content.toLowerCase();

then just change every message.content to content andi it should work

BeeTheKay
  • 319
  • 2
  • 15