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

309
Views
¿Hay alguna forma de hacer un comando en discord js que permita al usuario elegir una imagen (ruta de la imagen local) y enviarla?

Estuve buscando cómo enviar una imagen con un comando de bot y solo encontré cómo enviar la misma imagen desde el repositorio del proyecto o una URL estática, pero no vi cómo hacer un comando que permita al usuario para elegir una imagen y enviarla. Necesito esta función para crear un comando de bot que envíe un anuncio en un canal específico, e incluir una imagen en ese anuncio debería ser opcional.

He intentado esto:

 async execute(interaction) { if (!interaction.member.roles.cache.some((role) => role.name === "admin")) { await interaction.reply(`You don't have access !`); return; } else { const { MessageAttachment, MessageEmbed } = require("discord.js"); //extracting the image path const image_path = interaction.options.getString("image_path"); const file = new MessageAttachment(image_path); const exampleEmbed = new MessageEmbed().setTitle("Announcement image").setImage(image_path); //converting the msg to string const message = interaction.options.getString("message"); await interaction.reply(`${message} message sent !`); channel.send({ embeds: [exampleEmbed], files: [file] }); } }
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!