aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIndrajith K L2021-06-24 22:40:55 +0530
committerIndrajith K L2021-06-24 22:40:55 +0530
commit3332bd3dd6dceda7b364710d20afc205e2924809 (patch)
tree79646a4864def35a207b9b429c57378debe18fd2 /src
parente3019705453d6afb1199c10f803e05f189512934 (diff)
downloadradio-bot-3332bd3dd6dceda7b364710d20afc205e2924809.tar.gz
radio-bot-3332bd3dd6dceda7b364710d20afc205e2924809.tar.bz2
radio-bot-3332bd3dd6dceda7b364710d20afc205e2924809.zip
Fallback to next station when Radio Broadcast of station endsHEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/commands/tune.js6
1 files changed, 5 insertions, 1 deletions
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)