Skip to content

Commit

Permalink
🐛 #236 Destroying connection improperly (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-rw authored Nov 19, 2023
1 parent 02f2dbe commit 56d7f0f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# COPY THIS AND RENAME TO .ENV WHEN YOU RUN FROM SOURCE

DISCORD_CLIENT_TOKEN=
JELLYFIN_SERVER_ADDRESS=http://0.0.0.0:8096
JELLYFIN_AUTHENTICATION_USERNAME=
JELLYFIN_AUTHENTICATION_PASSWORD=
UPDATER_DISABLE_NOTIFICATIONS=false
ALLOW_EVERYONE=false
# LOG_LEVEl=DEBUG
5 changes: 3 additions & 2 deletions src/clients/discord/discord.voice.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ export class DiscordVoiceService {
};
}

this.voiceConnection.destroy();
this.voiceConnection.disconnect();
this.audioPlayer = undefined;
this.voiceConnection = undefined;
return {
success: true,
Expand All @@ -214,7 +215,7 @@ export class DiscordVoiceService {
);

connections.forEach((connection) => {
connection.destroy();
connection.disconnect();
});
}

Expand Down
9 changes: 7 additions & 2 deletions src/commands/disconnect.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ export class DisconnectCommand {
],
});

this.discordVoiceService.stop(false);
this.playbackService.getPlaylistOrDefault().clear();
const playlist = this.playbackService.getPlaylistOrDefault();

if (playlist.hasActiveTrack()) {
this.discordVoiceService.stop(false);
}
playlist.clear();

const disconnect = this.discordVoiceService.disconnect();

if (!disconnect.success) {
Expand Down

0 comments on commit 56d7f0f

Please sign in to comment.