Skip to content

Commit 72d8410

Browse files
proppyGerrit Code Review
authored andcommitted
Merge "shiritori/functions: refactor conversation"
2 parents 96788f4 + b1901c9 commit 72d8410

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

functions/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,21 @@ const dict = k => {
2828
};
2929

3030
function welcomeHandler (app) {
31-
app.data.used = ['しりとり'];
32-
app.ask('しりとり');
31+
app.ask('どうぞ、始めて下さい');
3332
}
3433

3534
function gameHandler (app) {
3635
shiritori.loaded.then(() => {
3736
const input = app.getRawInput();
3837
shiritori.interact(dict, input, app.data.used, {
3938
lose () {
40-
app.tell('ざんねん。');
39+
app.tell('ざんねん。あなたの負けです。');
4140
},
4241
win (word, kana) {
4342
if (word) {
4443
app.tell(`${word} [${kana}]`);
4544
} else {
46-
app.tell('すごい!');
45+
app.tell('すごい!あなたの勝ちです。');
4746
}
4847
},
4948
next (word, kana) {
@@ -69,6 +68,7 @@ actionMap.set('default', defaultHandler);
6968

7069
exports.shiritori = functions.https.onRequest((request, response) => {
7170
const app = new DialogflowApp({request, response});
71+
app.data.used = app.data.used || [];
7272
console.log('Request headers: ' + JSON.stringify(request.headers));
7373
console.log('Request body: ' + JSON.stringify(request.body));
7474
app.handleRequest(actionMap);

0 commit comments

Comments
 (0)