没有正确的软件包discord.js的音乐功能 [英] Music functionality without the correct package discord.js

查看:23
本文介绍了没有正确的软件包discord.js的音乐功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始制作Discord Bot时没有想到要添加音乐/语音功能.我现在想添加此内容,但作为 docs 状态您需要安装:

I started making a Discord Bot without thinking I would like to add music/voice functionality. I would now like to add this, but as the docs state you need to install:

不支持语音: npm install discord.js

具有语音支持(@ discordjs/opus): npm安装discord.js @ discordjs/opus

With voice support (@discordjs/opus): npm install discord.js @discordjs/opus

具有语音支持(操作): npm install discord.js opusscript

With voice support (opusscript): npm install discord.js opusscript

我一开始安装的是没有语音支持的设备,可以直接安装语音支持的软件还是将其弄乱.如果是这样,我还有其他选择吗?谢谢:)

I installed the one without voice support when I began, can I just install the voice support ones over or will that mess it up. If so, what are my other options? Thanks :)

推荐答案

如果您已经安装了discord.js,并且现在想要语音支持,那么您要做的就是 npm install< voice support module>(其中语音支持模块为@ discordjs/opus或opusscript).

If you've already installed discord.js and you now want voice support, all you have to do is npm install <voice support module> (where the voice support module is either @discordjs/opus or opusscript).

当您执行 npm install discord.js @ discordjs/opus 时,真正发生的是您要npm安装discord.js并安装@ discordjs/opus.您只需要安装两个不同的模块,并在一个命令中方便地完成它.就这样.如果您先 npm安装discord.js ,然后再 npm安装@ discordjs/opus ,它也会起作用.您的代码与何时安装无关,也与是否同时安装它们无关.您的代码只需要同时安装它们即可提供语音支持.

What's really happening when you do npm install discord.js @discordjs/opus is you're asking npm to install discord.js and to install @discordjs/opus. You're just installing two different modules, and doing it conveniently in one command. That's all. It would also work if you did npm install discord.js and then did npm install @discordjs/opus. Your code doesn't care when you installed those modules, and it doesn't care if you installed them at the same time or not. Your code just needs them both to be installed in order to provide voice support.

在文档和其他网站上,为方便起见,该命令列为 npm install discord.js @ discordjs/opus ,因此您可以只用一行安装两者,而不必为此输入两个单独的命令.因此,如果您已经安装了一个而不安装了另一个,则只需安装您所缺少的一个就可以了.当然,即使已经安装了discord.js,只需进行 npm install discord.js @ discordjs/opus 仍然可以,因为第二次只需重新安装discord.js.因此,只要您以某种方式,形状或形式安装语音支持模块,它就可以正常工作.

On the docs and other websites, the command is listed as npm install discord.js @discordjs/opus just for the sake of convenience, so you can install both with one line instead of having to type out two separate commands for it. So if you already have one installed and not the other, just install the one you're missing and everything works fine. Of course, simply doing npm install discord.js @discordjs/opus even though you already have discord.js installed will still also work, as it will simply reinstall discord.js for a second time. So really as long as you are installing the voice support modules in some way, shape, or form, it will work.

这篇关于没有正确的软件包discord.js的音乐功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆