skick1234 / DisTube

A powerful Discord.js module for simplifying music commands and effortless playback of various sources with integrated audio filters.
https://distube.js.org
MIT License
423 stars 94 forks source link

Cannot read property 'on' of null #53

Closed LackyPal closed 3 years ago

LackyPal commented 3 years ago

Describe the bug If i use seek command, then skip a song, I'm getting this Error. Otherwise it is working. If i skip without using seek Command before, no Error TypeError: Cannot read property 'on' of null at playingStart (/app/src/events/playSong.js:239:33) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:93:5)

Here is the code I'm using queue.dispatcher.on("finish", () => I've tried using queue.connection.dispatcher.on("finish", () => And queue.connection.on("finish", () =>

Sorry for bad English

skick1234 commented 3 years ago

This is your event bug, not related to DisTube.

Check your code in the playSong event.

LackyPal commented 3 years ago

Ok but can you please tell me , what should I use queue.connection.dispatcher.on("finish", () => Or queue.dispatcher.on("finish", () => Or anything else for finish event

And where should i write this code, on playSong event or anywhere

skick1234 commented 3 years ago

Because dispatcher changed when playing a song or using seek method, the easiest way is to fork DisTube because I don't want to emit many events.

Or you can use discord.js stuff to get the current dispatcher of the client in the guild and handle it.

LackyPal commented 3 years ago

Ok Thank you so much ❤️