diff options
| author | Reynard G <[email protected]> | 2024-01-16 19:44:44 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-01-16 19:44:44 -0600 |
| commit | 769f9da8a21ca467964142f57c79a0f482232900 (patch) | |
| tree | e5bc1bf82630db97d6d871597294eeb1afc4da96 /src/services | |
| parent | 45bdbd1494a59f590ec7a29a65df022ae6af05ab (diff) | |
| download | muse-769f9da8a21ca467964142f57c79a0f482232900.tar.xz muse-769f9da8a21ca467964142f57c79a0f482232900.zip | |
Add /loop-queue command (#989)
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/player.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/services/player.ts b/src/services/player.ts index 9754a42..c17a536 100644 --- a/src/services/player.ts +++ b/src/services/player.ts @@ -63,6 +63,7 @@ export default class { public status = STATUS.PAUSED; public guildId: string; public loopCurrentSong = false; + public loopCurrentQueue = false; private queue: QueuedSong[] = []; private queuePosition = 0; @@ -545,6 +546,17 @@ export default class { return; } + // Automatically re-add current song to queue + if (this.loopCurrentQueue && newState.status === AudioPlayerStatus.Idle && this.status === STATUS.PLAYING) { + const currentSong = this.getCurrent(); + + if (currentSong) { + this.add(currentSong); + } else { + throw new Error('No song currently playing.'); + } + } + if (newState.status === AudioPlayerStatus.Idle && this.status === STATUS.PLAYING) { await this.forward(1); } |
