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

321
Views
How to send images on discord.js node js?

i have problem with sending images from url when i try to make bot discord, i got the messages " Hello " but not with the images.

require('dotenv').config();
const Discord = require("discord.js");
const client = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES"]});
client.on("ready", () => {
  console.log(`Logged in as ${client.user.tag}!`)
})


client.on("message", msg => {
  if (msg.content === "p") {
    msg.reply("Hello", {files: ["https://s.imgur.com/images/logo-1200-630.jpg?2"]});
  }
})

client.login(process.env.DISCORD_TOKEN);
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

this is how you want to write it...

msg.reply("Hello",
{ files: [
{attachment: "https://s.imgur.com/images/logo-1200-630.jpg?2", name: "image.jpg"},
]});

the files: approach may be wrong though... if that doesn't work try this...

msg.reply("Hello https://s.imgur.com/images/logo-1200-630.jpg?2");
about 4 years ago · Juan Pablo Isaza Report

0

The best way is to use MessageAttachment like discord.js intended.

const image = new Discord.MessageAttachment("https://s.imgur.com/images/logo-1200-630.jpg?2","img.png");

msg.reply({ files : [image] })
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!