【问题标题】:Discord.js music bot not working on linux (yet working on windows)Discord.js 音乐机器人无法在 Linux 上运行(但在 Windows 上运行)
【发布时间】:2020-04-08 09:27:40
【问题描述】:

我决定编写一个将音乐流式传输到频道的命令。我写的代码-

module.exports = {
    name: "hardbass",
    category: "music",
    run: async (client, message, args, servers) => {
        const ffmpeg = require("ffmpeg");
        const opusscript = require("opusscript");

        if(!message.member.voiceChannel) return message.reply("Niesi vo voice channeli").then(x => x.delete(3000))

        await message.member.voiceChannel.join().then(connection => {
            connection.playArbitraryInput(`http://air2.radiorecord.ru:9003/hbass_320`);
          })
    }
}

-在 Windows 上完美运行,因此我决定将其移至我的树莓派(运行 raspbian,相同的 node.js 版本 - 13.3.0,也相同的 npm 版本),通常托管该机器人。令我惊讶的是,它没有用。机器人加入了频道,但没有播放任何音乐。根本没有错误消息。

【问题讨论】:

  • 可能缺少编解码器。

标签: node.js linux windows discord.js opus


【解决方案1】:

如果您还没有找到答案,我也经历过同样的事情。我的错误是 Linux 找不到 Opus 模块。只需在机器人所在的文件夹中输入npm i discordjs/opus,它就可以正常工作。将机器人切换回我的 Windows PC 时,它引发了同样的错误,因此我不得不重新安装 discordjs/opus。我猜你不能有一个与这两个操作系统兼容的版本?我仍在尝试自己寻找解决方案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    • 1970-01-01
    • 2012-04-02
    • 2015-02-26
    • 2018-05-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多