feat: tracksAdd event

This commit is contained in:
Snowflake107 2021-06-13 14:02:50 +05:45
parent e611143f58
commit 02d77264d7
2 changed files with 3 additions and 1 deletions

View file

@ -67,12 +67,13 @@ class Queue<T = unknown> {
} }
addTrack(track: Track) { addTrack(track: Track) {
this.addTracks([track]); this.tracks.push(track);
this.player.emit("trackAdd", this, track); this.player.emit("trackAdd", this, track);
} }
addTracks(tracks: Track[]) { addTracks(tracks: Track[]) {
this.tracks.push(...tracks); this.tracks.push(...tracks);
this.player.emit("tracksAdd", this, tracks);
} }
setPaused(paused?: boolean) { setPaused(paused?: boolean) {

View file

@ -132,6 +132,7 @@ export interface PlayerEvents {
searchInvalidResponse: () => any; searchInvalidResponse: () => any;
searchResults: () => any; searchResults: () => any;
trackAdd: (queue: Queue, track: Track) => any; trackAdd: (queue: Queue, track: Track) => any;
tracksAdd: (queue: Queue, track: Track[]) => any;
trackStart: (queue: Queue, track: Track) => any; trackStart: (queue: Queue, track: Track) => any;
} }