播放音乐时出现 Discord Bot 错误 - discord.js v13
Posted
技术标签:
【中文标题】播放音乐时出现 Discord Bot 错误 - discord.js v13【英文标题】:Discord Bot error when playing music - discord.js v13 【发布时间】:2022-01-20 22:59:51 【问题描述】:我制作了 Music Bot,想用 yt-search 和 ytdl-core 播放音乐,一切正常,但随后出现错误,我不知道如何解决这个问题。
const videos = await yts(message.content);
if (!videos.length) return message.reply("No songs were found!");
const song =
title: videos[0].title,
stream: ytdl(videos[0].url, filter: "audioonly"),
url: videos[0].url
;
const resource = createAudioResource(song.stream)
player.play(resource);
bot.connection.subscribe(player);
一段时间后,我收到以下错误:
N [Error]: aborted
at connResetException (node:internal/errors:691:14)
at TLSSocket.socketCloseListener (node:_http_client:407:19)
at TLSSocket.emit (node:events:402:35)
at node:net:687:12
at TCP.done (node:_tls_wrap:580:7)
resource: j
playStream: OggDemuxer
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
_remainder: null,
_head: null,
_bitstream: null,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: [Function: bound onwrite]
,
edges: [ [Object], [Object] ],
metadata: null,
volume: undefined,
encoder: undefined,
audioPlayer: H
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
_state: [Object],
subscribers: [Array],
behaviors: [Object],
debug: [Function (anonymous)],
[Symbol(kCapture)]: false
,
playbackDuration: 56740,
started: true,
silencePaddingFrames: 5,
silenceRemaining: -1
【问题讨论】:
【参考方案1】:对于遇到相同错误的每个人,只需使用此库从 ytdl-core 切换到 play-dl 一切正常!
【讨论】:
以上是关于播放音乐时出现 Discord Bot 错误 - discord.js v13的主要内容,如果未能解决你的问题,请参考以下文章
从 twitch bot 调用 Discord.js 音乐问题找到语音频道