Estoy creando un bot de discordia y estoy tratando de guardar cadenas en una matriz y enviarla si se envía el comando correcto. Aquí está el código:
client.on('messageCreate', (msg) => { if(!msg.content.startsWith(commandChar)) return; const args = msg.content.slice(1).split(' '); const cmdBody = msg.content.slice(msg.content.indexOf(' ')); const cmd = args.shift().toLowerCase(); switch(cmd) { case 'new': quotes.push(cmdBody); msg.channel.send('Quote added! The Quote Number is ' + quotes.length); break; case 'find': if(isNaN(cmdBody)) cmdBody--; try { text = quotes[cmdBody] msg.channel.send(text); } catch { msg.channel.send('There is no quote corresponding to the number' + (cmdBody + 1) + '.'); } break; case 'changeCommandChar': if(cmdBody.length === 1) { commandChar = cmdBody; msg.channel.send('Command Character changed! The new command Character is ' + commandChar); } break; }});
Aquí está el error:
RequestHandler.js: 350 lanzar nuevo DiscordAPIError (datos, res.status, solicitud);
DiscordAPIError: No se puede enviar un mensaje vacío