From f903c0fcce26d9ae52693fb4180eb819636e3529 Mon Sep 17 00:00:00 2001 From: Sameer Sahu Date: Sun, 15 Dec 2024 22:44:49 +0530 Subject: [PATCH 1/2] DiscordAPI Empty message error fixed ref:#1051 --- src/services/player.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/services/player.ts b/src/services/player.ts index b8330224..c560f942 100644 --- a/src/services/player.ts +++ b/src/services/player.ts @@ -633,7 +633,7 @@ export default class { private async onAudioPlayerIdle(_oldState: AudioPlayerState, newState: AudioPlayerState): Promise { // Automatically advance queued song at end if (this.loopCurrentSong && newState.status === AudioPlayerStatus.Idle && this.status === STATUS.PLAYING) { - await this.seek(0); + await this.seek(0); return; } @@ -654,10 +654,16 @@ export default class { const settings = await getGuildSettings(this.guildId); const {autoAnnounceNextSong} = settings; if (autoAnnounceNextSong && this.currentChannel) { - await this.currentChannel.send({ - embeds: this.getCurrent() ? [buildPlayingMessageEmbed(this)] : [], - }); - } + if (this.getCurrent()) { + await this.currentChannel.send({ + embeds: [buildPlayingMessageEmbed(this)] + }); + } else { + await this.currentChannel.send({ + content: "Queue is now empty, will leave in " + }); + } + } } } From 673005d8a09a5d60d67c72e8cdda3e96fce6ecfe Mon Sep 17 00:00:00 2001 From: Sameer Sahu Date: Sat, 25 Jan 2025 19:08:36 +0530 Subject: [PATCH 2/2] lint fixes --- src/services/player.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/player.ts b/src/services/player.ts index c377b073..070d6780 100644 --- a/src/services/player.ts +++ b/src/services/player.ts @@ -637,7 +637,7 @@ export default class { private async onAudioPlayerIdle(_oldState: AudioPlayerState, newState: AudioPlayerState): Promise { // Automatically advance queued song at end if (this.loopCurrentSong && newState.status === AudioPlayerStatus.Idle && this.status === STATUS.PLAYING) { - await this.seek(0); + await this.seek(0); return; } @@ -660,14 +660,14 @@ export default class { if (autoAnnounceNextSong && this.currentChannel) { if (this.getCurrent()) { await this.currentChannel.send({ - embeds: [buildPlayingMessageEmbed(this)] + embeds: [buildPlayingMessageEmbed(this)], }); } else { await this.currentChannel.send({ - content: "Queue is now empty, will leave in " + content: 'Queue is now empty', }); } - } + } } }