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

245
Views
Faltan permisos al usar bulkDelete() en los propios mensajes del bot

Estoy tratando de implementar un comando para eliminar los N últimos mensajes del bot en un canal. El bot no tiene permiso MANAGE_MESSAGES . Cuando N = 1, el bot elimina su último mensaje, según lo previsto. Sin embargo, cuando N > 1, el bot arroja el error:

 D:\Seneca\7th_Term\DPS909\EarTensifier\node_modules\discord.js\src\rest\RequestHandler.js:170 return reject(new DiscordAPIError(request.path, data, request.method, res.status)); ^ DiscordAPIError: Missing Permissions at RequestHandler.execute (D:\Seneca\7th_Term\DPS909\EarTensifier\node_modules\discord.js\src\rest\RequestHandler.js:170:25) at processTicksAndRejections (node:internal/process/task_queues:96:5) { method: 'post', path: '/channels/757408200973877277/messages/bulk-delete', code: 50013, httpStatus: 403 }

Lo que me resulta extraño es que, ¿cómo es que el bot puede eliminar 1 de sus mensajes, pero no más? Cuando probé el mismo código con MANAGE_MESSAGES habilitado, funciona perfectamente. ¿Es posible implementar esta funcionalidad sin el permiso MANAGE_MESSAGES , ya que solo quiero que el bot elimine sus propios mensajes, no los de otros?

Aquí está mi implementación:

 const botID = process.env.DISCORD_ID; if (message.channel.type == 'text') { await message.channel.messages.fetch({limit: 100}).then(messages => { let botMessages = messages.filter(msg => msg.author == botID).array(); if (no_of_messages > 0){ botMessages.splice(no_of_messages); } message.channel.bulkDelete(botMessages); client.log(`Deleted ${botMessages.length} messages from ${botID}`) }).catch(err => { client.log('Error while doing Bulk Delete'); client.log(err); }); }
about 4 years ago · Juan Pablo Isaza
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!