Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

196
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

0

Use this :

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

0

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

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda