0
我正在用Discord.py製作Discord的bot,當用戶請求播放歌曲時,如果播放時間超過特定時間,我會一直遇到此錯誤。歌曲中斷,然後播放器播放隊列中的下一首歌曲。YoutubeDL用Discord.py讀取錯誤
我使用庫中包含的默認state.voice.create_ytdl_player()
。
[tls @ 0000000000eb9ca0] Unable to read from socket
[matroska,webm @ 0000000000eb7620] Read error
[tls @ 0000000000eb9ca0] Unable to read from socket
Last message repeated 1 times
[tls @ 0000000000eb9ca0] Failed to send close message
WARNING: unable to extract uploader nickname
WARNING: unable to extract uploader nickname
我的代碼:
@commands.command(pass_context=True, no_pm=True)
async def play(self, ctx, *, song : str):
state = self.get_voice_state(ctx.message.server)
opts = {
'default_search': 'auto',
'quiet': True,
}
if state.voice is None:
success = await ctx.invoke(self.summon)
if not success:
return
try:
tmp = await self.bot.send_message(ctx.message.channel, "Searching for `" + song + "`...")
player = await state.voice.create_ytdl_player(song, ytdl_options=opts, after=state.toggle_next)
except Exception as e:
print(debugging.ERROR + "ERROR in 'play' command: " + str(e))
fmt = ':warning: An error occurred while processing this request: ```py\n{}: {}\n```'
await self.bot.send_message(ctx.message.channel, fmt.format(type(e).__name__, e))
else:
player.volume = 0.6
entry = VoiceEntry(ctx.message, player)
await self.bot.edit_message(tmp, ':notes: Added ' + str(entry) + ' to the song queue.')
await state.songs.put(entry)