- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的 Discord 机器人命令之一是在当前用户的语音 channel 中播放预定义的音乐剪辑。机器人可以连接,但不是播放歌曲,而是立即离开。我已经尝试同时使用 connection.playStream
以及 connection.playFile
,并且两者似乎都返回相同(缺少)的输出。我是否缺少某种依赖关系,或者我的代码是否写错了?任何帮助将不胜感激!
const Discord = require('discord.js');
const ytdl = require('ytdl-core');
const client = new Discord.Client();
const streamOptions = { seek: 0, volume: 1};
client.on('ready', () => {
console.log('Login Success');
});
client.on('message', message => {
if (message.content === '$vaporwave') {
if (!message.guild) return;
if(message.member.voiceChannel) {
message.member.voiceChannel.join().then(connection => {
console.log("joined channel");
//const stream = ytdl('https://www.youtube.com/watch?v=cU8HrO7XuiE', { filter : 'audioonly' });
const dispatcher = connection.playFile('./mcp420.mp3');
//const dispatcher = connection.playStream(stream, streamOptions);
dispatcher.on("end", end => {
console.log("left channel");
message.member.voiceChannel.leave();
});
}).catch(err => console.log(err));
}
}
});
最佳答案
通过使用 dispatcher.on('error', console.error);
,我发现sodium
没有安装在我的主机上,并且在文件播放过程中导致错误。现在工作正常。
关于javascript - Discord.js 和 ytdl 的未知问题,完全跳过播放音频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47386642/
我试图制作一个供个人使用的不和谐音乐机器人,因为 groovy 和 rythm 被关闭了。 我猜它工作正常,但我遇到了 ytdl 的问题。 输入“-play”和一个 url 就像预期的那样工作,但我不
我已经下载了 ytdl-core,我正在将它与 discord.js 一起使用。我有一个命令可以将 YouTube 视频的音频播放到语音聊天中。有谁知道我可以从链接中获取视频标题字符串的方法,或者获取
我正在使用 ytdl-core 和 node-opus 向我的机器人添加音乐功能。我也在关注教程。在我开始添加排队功能之前,该机器人运行良好。当我整合排队时,机器人仍然可以加入和离开语音 channe
我的 Discord 机器人命令之一是在当前用户的语音 channel 中播放预定义的音乐剪辑。机器人可以连接,但不是播放歌曲,而是立即离开。我已经尝试同时使用 connection.playStre
当我尝试在 ytdl-core 中从 YouTube 中提取音乐时,控制台上出现 404 错误。这个错误来自 miniget 包。 ytdl-core 正在使用 miniget。 代码: ytdl("
我正在尝试使用 ytdl-core 模块 ( https://github.com/fent/node-ytdl-core ) 下载 Youtube 视频音频。 我使用 Express 编写了一个 A
我正在尝试使用 ytdl 和 discord.js 下载并播放从 youtube 获取的音频文件: ytdl(url) .pipe(fs.createWrite
我制作了一个 api,它正在从 youtube 链接下载视频,但我无法下载其音频高于 360p 格式的视频。它只下载视频,没有音频。 有什么解决办法吗? 最佳答案 通常 1080p 或更好的视频没有用
我想让用户能够使用 node-ytdl 下载 YouTube 视频。例如,当客户端对特定路由发出 GET 请求时,应下载视频作为响应。 var ytdl = require('ytdl-core'
我使用 ytdl 构建了一个 discord bot,它工作正常但随机出现此错误,我无法找出原因:(我用 ... 截断了链接,因为它太长了) [https @ 000001ead63ee980] HT
我构建了一个简单的 youtube 下载器 cli。它看起来像这样(没有任何 arg 解析以便于复制): const ytdl = require('ytdl-core'); const config
我是一名优秀的程序员,十分优秀!