From 3332bd3dd6dceda7b364710d20afc205e2924809 Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Thu, 24 Jun 2021 22:40:55 +0530 Subject: Fallback to next station when Radio Broadcast of station ends --- src/commands/tune.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/commands/tune.js b/src/commands/tune.js index 3c78474..f7502be 100644 --- a/src/commands/tune.js +++ b/src/commands/tune.js @@ -37,7 +37,11 @@ async function playRadio(connection, textChannel, args, client) { } } currentRadioStation = radioStations[radioIndex]; - connection.play(`${currentRadioStation.url}`, { seek: 0, volume: 1 }); + connection.play(`${currentRadioStation.url}`, { seek: 0, volume: 1 }) + .on('finish', () => { + textChannel.send(`${currentRadioStation.name}: Broadcast ended. Tuning into next station....`); + playRadio(connection, textChannel, ['next'], client); + }); const nowPlayingMessage = new MessageEmbed() .setTitle("Now Playing") .setDescription(currentRadioStation.name) -- cgit v1.2.3