Skip to content

Commit eec2a98

Browse files
committed
Send a finishing message after finishing the video
1 parent 75c27c0 commit eec2a98

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,12 @@ async function playVideo(message: Message, videoSource: string, title?: string)
531531
logger.error(`Error in playVideo for ${title || videoSource}:`, error);
532532
if (!controller.signal.aborted) controller?.abort();
533533
} finally {
534+
if (!streamStatus.manualStop && !controller.signal.aborted) {
535+
await sendFinishMessage();
536+
}
537+
534538
await cleanupStreamStatus();
539+
535540
if (tempFilePath && !isLiveYouTubeStream) {
536541
try {
537542
logger.info(`Attempting to delete temp file: ${tempFilePath}`);
@@ -541,9 +546,6 @@ async function playVideo(message: Message, videoSource: string, title?: string)
541546
logger.error(`Failed to delete temp file ${tempFilePath}:`, cleanupError);
542547
}
543548
}
544-
if (!streamStatus.manualStop && !controller.signal.aborted) {
545-
await sendFinishMessage();
546-
}
547549
}
548550
}
549551

0 commit comments

Comments
 (0)