Created
August 5, 2019 21:34
-
-
Save Fleker/8686089853ec2cf67b5f18ffac74dfa9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.intent('actions.intent.MEDIA_STATUS', (conv: Conv) => { | |
const mediaStatus = conv.arguments.get('MEDIA_STATUS') | |
let response = 'Unknown media status received.' | |
if (mediaStatus && mediaStatus.status === 'FINISHED') { | |
response = 'Hope you enjoyed that song. What else do you want to listen to?'; | |
} | |
conv.ask(response) | |
conv.ask(new Suggestions('Repeat')) | |
conv.ask(getSuggestions(conv.data.json.tracks)) | |
}) | |
app.intent('Repeat', (conv: Conv) => { | |
const track = conv.data.currentTrack | |
if (!track) { | |
conv.ask('Sorry, I do not know what track you want to play. What else do you want to listen to?') | |
conv.ask(getSuggestions(conv.data.json.tracks)) | |
return | |
} | |
conv.ask(`Once again, here's ${track.track_title}`) | |
conv.ask(generateMediaResponse(track)) | |
conv.ask(getSuggestions(conv.data.json.tracks)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment