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

查看:15
本文介绍了没有正确包 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 install discord.js @discordjs/opus

支持语音(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 install discord.js 然后执行 npm install @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天全站免登陆