Add /loop-queue command (#989)

This commit is contained in:
Reynard G 2024-01-16 19:44:44 -06:00 committed by GitHub
parent 45bdbd1494
commit 769f9da8a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 64 additions and 1 deletions

View file

@ -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);
}