2017-11-25 188 views
0

所以,我試着用discord.js做一個ytdl的東西。我得到一個錯誤,說不能得到discord.js與ytdl核心播放歌曲

(node:6796) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Parameter "url" must be a string, not undefined".

這是機器人應該玩的東西。 ((是ytdl定義)​​)

const dispatcher = connection.playStream(ytdl(args[1])) 
.on("end",() => { 
    console.log("song end"); 
}) 
.on("error",() => { 
    console.error(error); 
}); 
+0

ytdl的'值( args [1])'是未定義的(因爲錯誤告訴你) – ext

+0

'args [1]'的值是什麼?你能告訴我們如何構建'args'對象嗎? –

回答

0

這基本上意味着「沒有什麼是有‘URL’或ytdl()參數,你應該檢查它是否是空或不是。