Slide 48
Slide 48 text
index.jsͷղઆ ᶄ
• line: 20-49
// Match IntentΛࢹ
app.intent('Match', (conv) => {
// ϢʔβʔͷखΛऔಘɻDialogflowͷParameter໊
let userHandType = conv.parameters['handType'];
// ------ ͜͜ʹҟৗܥͷॲཧ͕͋Δ ------
// ΞϓϦͷखΛܾఆɻϥϯμϜͰબ͍ͯ͠Δɻ
const appHandType = constants.VALID_HAND_TYPE[Math.floor(Math.random() * constants.VALID_HAND_TYPE.length)];
// উഊΛܾఆ
const matchType = constants.MATCH_RESULT[userHandType][appHandType];
// উഊผͷॲཧ
const resultMessage = constants.SPEAK_MESSAGE_RESULT[matchType].replace("%HAND", appHandType);
// Ϩεϙϯε
conv.ask(resultMessage);
});
© 2018 Shinji Ichien 48