Currently, I am working on a Discord bot using discord.js and utilizing a switch statement. However, I am encountering an issue where the "default:" case keeps repeating itself every time any other case is executed.
I have already investigated for cases without breaks and attempted to switch between double quotation marks and single quotation marks. Can someone please explain why this is happening and suggest a solution?
const wrongResponse = ["1", "2", "3"];
var randomResponse = wrongResponse[Math.floor(Math.random() * wrongResponse.length)];
bot.on("message", message => {
let args = message.content.substring(calling.length).split(" ");
switch (args[0]) {
case 'commands':
const embed = new Discord.RichEmbed()
.setDescription("commands here");
message.channel.send(embed);
break;
case 'search':
message.reply("nothing yet");
break;
default:
message.reply(randomResponse);
break;
};
});