调度程序播放在 10 分钟后停止 (discord.js)
Posted
技术标签:
【中文标题】调度程序播放在 10 分钟后停止 (discord.js)【英文标题】:Dispatcher playback stops after 10 minutes (discord.js) 【发布时间】:2021-08-28 09:13:01 【问题描述】:所以我一直在开发一个 discord.js 音乐机器人。到目前为止,我正在使用@discordjs/opus 和ytdl-core-discord,当我从我的机器本地运行机器人时,一切似乎都运行良好。我可以从 YouTube 流式传输歌曲并毫无障碍地欣赏它们。但是,当我在repl.it 上托管我的机器人时(我正在使用黑客计划),机器人将播放大约 10 分钟的音乐,之后播放突然停止。机器人本身可以运行,但播放已停止。我自己尝试调试过这个问题并遇到了以下问题。
错误信息是:-
Error: aborted
at connResetException (node:internal/errors:683:14)
at TLSSocket.socketCloseListener (node:_http_client:407:19)
at TLSSocket.emit (node:events:377:35)
at node:net:661:12
at TCP.done (node:_tls_wrap:578:7)
code: 'ECONNRESET'
我从以下获得的:-
dispatcher.on('error', console.log);
这是调试日志:-
[VOICE (796060146048041020:0)]: [WS] >> "op":5,"d":"speaking":1,"delay":0,"s-s-rc":371158
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":66569681578
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":66569681578
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":26930605505
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":26930605505
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":79496921836
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":79496921836
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 40ms.
Running command music:queue.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":33712802512
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":33712802512
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":24138243497
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":24138243497
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":13166311857
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":13166311857
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 43ms.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":67664333492
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":67664333492
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":37125764206
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":37125764206
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":93951547272
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":93951547272
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 45ms.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":24135858671
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":24135858671
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":55152836464
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":55152836464
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":40854416435
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":40854416435
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 40ms.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":5512391576
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":5512391576
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":45106447764
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":45106447764
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":40817416696
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":40817416696
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 67ms.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":35720124862
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":35720124862
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":30746596945
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":30746596945
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":17419829656
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":17419829656
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 40ms.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":65665457127
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":65665457127
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":70834746297
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":70834746297
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":92395018869
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":92395018869
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 46ms.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":79875631149
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":79875631149
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":7259025537
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":7259025537
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":40628799373
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":40628799373
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 41ms.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":28632941276
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":28632941276
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":50220532802
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":50220532802
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":42549939695
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":42549939695
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 41ms.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":16937277053
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":16937277053
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":69437133821
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":69437133821
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":57642496053
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":57642496053
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 41ms.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":62889522438
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":62889522438
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":39924399059
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":39924399059
<error message here>
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":61045185967
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":61045185967
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 40ms.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":27875289189
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":27875289189
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":7676658441
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":7676658441
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":3557602962
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":3557602962
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 40ms.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":21564175818
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":21564175818
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":35294465928
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":35294465928
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":95461363767
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":95461363767
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 43ms.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":37687966891
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":37687966891
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":42964005186
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":42964005186
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":58201701635
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":58201701635
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 45ms.
[VOICE (796060146048041020:0)]: [WS] >> "op":3,"d":2702569957
[VOICE (796060146048041020:0)]: [WS] << "op":6,"d":2702569957
我从以下获得的:-
client.on('debug', console.log);
非常感谢这方面的任何帮助:)
【问题讨论】:
您正在使用 windows 在本地进行测试? @HellCatVN 是的,Windows 10 x64。 Node.js 版本 16 你安装了 ffmpeg 吗?如果是,请尝试将djs/opus
替换为 node-opus
或 opusscript
如何在我的 repl 上安装 ffmpeg?我的本地系统上没有它,但没有它也可以正常工作
这种情况会导致音乐解码器出错,所以如果你想稳定你应该设置你自己的服务器,这样你就可以管理几乎情况
【参考方案1】:
好的,所以我回答我自己的问题。所以发生的事情是我在我的 repl 上运行节点版本 16,因为默认节点版本是 10 并且不支持discord.js
。所以我刚刚完成了npm i node@latest
,它自动安装了版本 16。这是一个问题,因为它是非 LTS 版本的节点。所以我不得不通过 - npm uninstall node
卸载它并通过 npm i node@14
安装节点的第 14 版,这只是解决了这个问题。现在我只需要在我的 repl 上使用 npx node
而不是 node
就可以了!如果您遇到同样的问题,我建议您先尝试一下。
【讨论】:
以上是关于调度程序播放在 10 分钟后停止 (discord.js)的主要内容,如果未能解决你的问题,请参考以下文章
discord.py FFmpegPCMAudio 在声音文件中间停止播放声音
如果应用程序停止,quartz 调度程序获取下一个调度程序时间