Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

231
Views
"DiscordAPIError: no se puede enviar un mensaje vacío"

Estoy tratando de hacer un bot de discordia de blasfemias. Siempre que lo ejecuto, está bien, pero cuando escribo una palabra que se supone que debe filtrar, se detiene. Este es el error que recibo al escribir una palabra bloqueada.

 DiscordAPIError: Cannot send an empty message at RequestHandler.execute (C:\Users\loser\Desktop\word filter bot\node_modules\discord.js\src\rest\RequestHandler.js:350:13) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async RequestHandler.push (C:\Users\loser\Desktop\word filter bot\node_modules\discord.js\src\rest\RequestHandler.js:51:14) at async TextChannel.send (C:\Users\loser\Desktop\word filter bot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:175:15) at async Client.<anonymous> (C:\Users\loser\Desktop\word filter bot\index.js:33:19) { method: 'post', path: '/channels/954840804466257921/messages', code: 50006, httpStatus: 400, requestData: { json: { content: undefined, tts: false, nonce: undefined, embeds: undefined, components: undefined, username: undefined, avatar_url: undefined, allowed_mentions: undefined, flags: undefined, message_reference: undefined, attachments: undefined, sticker_ids: undefined }, files: [] } }

y aquí está mi código

 const Discord = require('discord.js'); const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] }); const prefix = '-' client.once('ready', () => { console.log('woohoo, Im ready to get online and block some words!') client.user.setActivity('-help', {type: 'LISTENING'}) }) client.on('message', async message => { if(message.channel.type === 'dm' || message.author.bot) return; const logChannel = client.channels.cache.find(channel => channel.id === '954845946326450206') let words = ["banana", "orange"] let foundInText = false; for (var i in words) { if (message.content.toLowerCase().includes(words[i].toLowerCase())) foundInText = true; } if (foundInText) { let logEmbed = new Discord.MessageEmbed() .setDescription(`<@${message.author.id}> Said a bad word`) .addField('The Message', message.content) .setColor('RANDOM') .setTimestamp() logChannel.send(logEmbed) let embed = new Discord.MessageEmbed() .setDescription(`That word is not allowed here`) .setColor('RANDOM') .setTimestamp() let msg = await message.channel.send(embed); message.delete() msg.delete({timeout: '3500'}) } })

¿Hay alguna forma de que me puedan ayudar? Realmente me gustaría poner esto en marcha.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Supongo que estás usando discord.js v13.

El método de send solo toma un parámetro desde v13. Puedes usar send({ embeds: [your, cool, embeds] }); para enviar incrustaciones o cualquier mensaje que contenga no solo contenidos.

Además Message.prototype.delete() no toma ningún parámetro ahora. Debe usar setTimeout si desea eliminar mensajes después de una cierta cantidad de tiempo.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!