Discord.JS 获取附件 URL 并在频道中发送
Discord.JS Get Attachment URL and send in channel
我有这个机器人代码“discord.js v13”,我需要获取附件的 URL 并立即发送 link。我怎样才能做到这一点?我将代码部分留在下面
// 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!`);
}
我有这个机器人代码“discord.js v13”,我需要获取附件的 URL 并立即发送 link。我怎样才能做到这一点?我将代码部分留在下面
// 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!`);
}