Skip to content

Commit

Permalink
Send state to subscribed clients on queue init
Browse files Browse the repository at this point in the history
  • Loading branch information
PapiOphidian committed Nov 17, 2023
1 parent d4d4280 commit 6b794ad
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/runtime-website/src/music/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,10 @@ export class Queue {
if (position === -1) this.tracks.push(track)
else this.tracks.splice(position, 0, track)

if (!this.playHasBeenCalled) this.play()

sessions.filter(s => s.guild === this.guildID).forEach(s => s.onTrackAdd(track, position))
if (!this.playHasBeenCalled) {
this.play()
sessions.filter(s => s.guild === this.guildID).forEach(s => s.sendState())
} else sessions.filter(s => s.guild === this.guildID).forEach(s => s.onTrackAdd(track, position))
}

public async removeTrack(index: number): Promise<0 | 1 | 2> {
Expand Down

0 comments on commit 6b794ad

Please sign in to comment.