Aws lambda Alexa定制技能-与其他技能互动
我想以特定的方式播放一首特别的歌曲Aws lambda Alexa定制技能-与其他技能互动,aws-lambda,spotify,alexa-skills-kit,alexa-skill,Aws Lambda,Spotify,Alexa Skills Kit,Alexa Skill,我想以特定的方式播放一首特别的歌曲 let speechText = ``;//Happy ${currentYear - year}th birthday!`; if (currentDate.getTime() !== nextBirthday.getTime()) { if(currentDate.getTime() > nextBirthday.getTime()){ speechText = `Ciao Alberto! Hai
let speechText = ``;//Happy ${currentYear - year}th birthday!`;
if (currentDate.getTime() !== nextBirthday.getTime()) {
if(currentDate.getTime() > nextBirthday.getTime()){
speechText = `Ciao Alberto! Hai già festeggiato il tuo compleanno quest'anno!!, Ti sei divertito?`;
} else {
const diffDays = Math.round(Math.abs((currentDate.getTime() - nextBirthday.getTime())/oneDay));
speechText = `Ciao Alberto! Mancano ${diffDays} giorni al tuo primo compleanno!! Sei emozionato?`;
//speechText = `Welcome back. It looks like there are ${diffDays} days until your ${currentYear - year}th birthday.`
}
} else {
// PLAY THAT SONG
}
如果可能的话,你能告诉我正确的文件吗。
谢谢。我找到了解决方案:
else{
expectedPreviousToken = 'sometoken' + Math.random();
return handlerInput.responseBuilder
//.speak('start playing sound')
.addAudioPlayerPlayDirective('REPLACE_ALL', podcastURL, expectedPreviousToken, 0, null)
.withSimpleCard('Example', 'Example')
.getResponse();}
你说的“特定方式”是什么意思?当某人生日的时候,你想播放一首歌吗?是的,我想在ELSE语句中播放一首歌(“生日快乐”)。