无法发送本地.mp3文件! (discord.js v12)

时间:2020-08-13 14:37:31

标签: javascript node.js discord discord.js

这会将空文件发送给消息作者。

Image

我该如何解决?我可以在PC上正常播放它们,但是当机器人发送它们时,它不起作用。

if (command == "mp3") {
    const filename = message.author.username


    const url = args.join(" ");

    let stream = ytdl(url, {
        encoderArgs: ["-af", "asetrate=44100*1.25,bass=g=20,dynaudnorm=f=150"],
        fmt: "mp3",
        opusEncoded: false
        //downloaded the file


    });
    stream.pipe(createWriteStream(__dirname + `/downloads/${filename}.mp3`));
    //saves it

    message.reply(":white_check_mark: check your DM's");


    message.author.send({
        files: [`./downloads/${filename}.mp3`]
        //sends the file to the user

    });

}

0 个答案:

没有答案