如何解决如何向alexa询问介于两者之间的值?
我从交互模型中获取输入 - {borrower,amount,date}
我想验证用户在后端给我的日期,即借用日期不能大于今天。
const addNewDebtIntentHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest'
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'newDebt';
},handle(handlerInput) {
const borrower = handlerInput.requestEnvelope.request.intent.slots.borrower.value;
const amount = handlerInput.requestEnvelope.request.intent.slots.amount.value;
var date = handlerInput.requestEnvelope.request.intent.slots.date.value;
// console.log(date);
const currTime = moment().format('YYYY-MM-DD');
if(date>currTime)
{
const futureError = 'Future is yet to come! What do you want me to do?';
return handlerInput.responseBuilder
.speak(futureError)
.reprompt('What do you want me to do?')
.getResponse();
}
const speakOutput = handlerInput.t('ADD_NEW_DEBT_MSG',{borrower,date});
return handlerInput.responseBuilder
.speak(speakOutput)
.reprompt(speakOutput)
.getResponse();
}
};
请帮助我 -
if(date>currTime)
部分。
我希望 alexa 接受另一个日期的输入并重新验证它。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。