So i'm making a discord bot and trying to implement music with discord.js, node-opus, and ytdl-core. But randomly, while executing commands (mostly >>stop) I will get a ReferenceError which completely stop the command, while trying another time, without changes, the command will complete successfully. Any help?

Bot Snippet | Below is the error that occurrs randomly while executing commands.

(node:11740) UnhandledPromiseRejectionWarning: ReferenceError: message is not defined
at StreamDispatcher.<anonymous> (C:\Users\###\Desktop\real_bot_code\main.js:286:7)
at StreamDispatcher.emit (events.js:200:13)
at StreamDispatcher.destroy (C:\Users\###\Desktop\real_bot_code\node_modules\discord.js\src\client\voice\dispatcher\StreamDispatcher.js:294:10)
at AudioPlayer.destroyCurrentStream (C:\Users\###\Desktop\real_bot_code\node_modules\discord.js\src\client\voice\player\AudioPlayer.js:77:18)
at VoiceConnection.<anonymous> (C:\Users\###\Desktop\real_bot_code\node_modules\discord.js\src\client\voice\player\AudioPlayer.js:42:53)
at Object.onceWrapper (events.js:288:20)
at VoiceConnection.emit (events.js:205:15)
at VoiceConnection.disconnect (C:\Users\###\Desktop\real_bot_code\node_modules\discord.js\src\client\voice\VoiceConnection.js:311:10)
at VoiceChannel.leave (C:\Users\###\Desktop\real_bot_code\node_modules\discord.js\src\structures\VoiceChannel.js:142:69)
at Client.<anonymous> (C:\Users\###\Desktop\real_bot_code\main.js:179:31)

Sorry if this is a bad example, im pretty new to stack and discord.js.

0 Answers