尽管已安装软件包,但未发现Oppus Engine错误

时间:2020-05-10 06:55:20

标签: javascript node.js discord.js npm-install opus

这个问题整天困扰着我,我无法弄清楚哪里出了问题。我已经看过其他有关如何通过discord.js播放mp3文件的教程,以及其他介绍如何消除此错误的页面。他们都只是说要安装软件包,但我已经安装了超过必要数量的软件包,包括:discord.js ffmpeg opusscript @discordjs/opus ytdl-core node-opus。但是,当我在下面运行此代码时,每次都会遇到相同的错误,(node:10912) UnhandledPromiseRejectionWarning: Error: Couldn't find an Opus engine.我真的很沮丧,不知道现在该怎么办。任何帮助深表感谢。 这是我的代码:

const Discord = require('discord.js');
const client = new Discord.Client();
const ytdl = require('ytdl-core');

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);

});

client.on('message', message => {
    var server = client.guilds[message.guild.id];
    var mention = 0;
    console.log(message.content);
    if(message.mentions)
    {
        mention = message.mentions.users.first();
        // console.log(message.author);
    }

  if (message.content === 'testing') {


    message.reply(' test Succesful!');
    // console.log(message.channel.id+" and the guild is: "+ message.guild.id);
    if (message.member.voiceChannel)
    {
        message.member.voiceChannel.join().then(connection => {
            connection.playFile(`C:\\Users\\user\\Downloads\\Shepard Tone.mp3`)
            console.log("Successfully connected.");
          })
    }
    else
    {
        message.reply(" Make sure you are in a voice channel.")
    }
  }
});
client.login('SUPER SECRET TOKEN');

0 个答案:

没有答案