Closed Murky-MoMo closed 3 years ago
bot.on("message", list); // Jadwal Command bot.on("message", jadwal); // Ping Command bot.on("message", ping); // Search Command bot.on("message", search); // Audio Command bot.on("message", audio); // Covid Command bot.on("message", covid);
all of the if cases can be inside a single message event listener
bot.on("message" message=> { if (command == "jadwal").... if (command == "search").... })
not only is the code inefficient but so adding so many listeners will lead you to get a Memory leak error for more on command handling, i suggest you check out the official guide https://discordjs.guide/command-handling/#individual-command-files
OK, I will fix that. Thank you for your suggestion :)
all of the if cases can be inside a single message event listener
not only is the code inefficient but so adding so many listeners will lead you to get a Memory leak error for more on command handling, i suggest you check out the official guide https://discordjs.guide/command-handling/#individual-command-files