I have this bot code "discord.js v13", I need to get the URL of the attached file and send the link right away. how can I do this? I will leave the code part below
// save file in folder 'musicas'
stream.pipe(createWriteStream(__dirname + `/musicas/${pegaid}.mp3`)).on('finish', () => {
// Sending the attachment, and its link
try {
message.channel.send({
files: [{
attachment: (__dirname + `/musicas/${musicid}.mp3`),
name: `${musicid}.mp3`
}],
});
} catch (e) {
return message.channel.send(`${message.author}, Error ao tentar converter a música!`);
}
I'm guessing you want to send the URL of the attached file. Unfortunately, you can only send the URL after sending the attachment itself first.
const image = await message.channel.send({ files: [{ attachment: `full-path`, name: `something.mp3` }] });
return message.channel.send({ content: `${image.attachments.first().proxyURL}` });
Read More about it in the discord.js documentation here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.