I am making a discord bot and one of my commands is not working. I want the bot to copy what the user said in the command but I am getting the Error: UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): DiscordAPIError: Cannot send empty message and I also tried using console.log() but that was empty too so I know something is wrong but i'm just not sure what is.
case "say":
if(!args[1] == " "|| !args[1] == ""){
// message.channel.sendMessage(args[1]);
words = [];
for(i=0;i==args.length-1;i++){
words.append(args[i]);
}
var wordsString = words.join(" and ");
console.warn("Bot said: "+wordsString);
message.channel.sendMessage(wordsString);
}
break;
args[1].trim().lengthwould combine bothifs into one. Also, what doesappenddo? Not a native array function I'm familiar with...