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

195
Views
Bot copy the message url in discord.js

Can bot somehow copy the url of the message he just send? I was trying to do something like that but it didnt work

channel1.send("test",{
            embed:embed,
          });
const messageurl = client.message.cache.find(URL)
message.channel.send(`${messageurl}`)
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

First, the options for sending message in a channel is a string or an object. If you use that wrong method, your bot only sends test into the text channel. Replace it with .send({ <options> }) so you can send multiple items.

Second, embed option for sending a message must be an array if you are using discord.js v13:

channel.send({ embeds: [] });

Finally, <textChannel>.send() method returns a Promise with message sent. Get the message your bot sent by defining const msg = await channel1.send({ <options> });(Await is only available in async function). Now we can access the message's attribute such as ID, url, author… etc. The URL which you want is the msg.url. Here is the final code:

(async () => {
    const msg = await channel1.send({
            content: "test",
            embeds: [ embed ],
          });
    channel1.send(`${msg.url}`);
})();

Hope this will help you, comment on this answer if you still have any issue about it.

about 4 years ago · Juan Pablo Isaza Report

0

Use this :

const msg = await channel1.send("test",{
            embed:embed,
          });
channel1.send(`${msg.url}`)
about 4 years ago · Juan Pablo Isaza Report

0

channel1.send({ content: `${msg.url}`, embeds: [embed] })

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!