メッセージを日本語に

This commit is contained in:
ろむねこ 2024-07-17 16:12:19 +09:00
parent 3629140c9f
commit 04cba883f5
Signed by: Fujimatsu
GPG Key ID: FA1F39A1BA37D168

View File

@ -9,6 +9,7 @@ import { TaskListResponse } from './models/Task';
import AttributeUtils from './AttributeUtils';
import { ChildListResponse } from './models/Child';
import ChildService from './service/ChildService';
import { MESSAGES } from './const';
const LaunchRequestHandler = {
canHandle(handlerInput: Alexa.HandlerInput) {
@ -51,7 +52,7 @@ const KidShiftAuthIntentHandler = {
await attributeUtils.setToken(tokenResponse.accessToken);
await attributeUtils.saveAttributes();
return handlerInput.responseBuilder
.speak('Login successful')
.speak(MESSAGES.LOGGED_IN)
.getResponse();
} else {
return handlerInput.responseBuilder
@ -98,24 +99,24 @@ const KidShiftTaskCompleteIntentHandler = {
const task = taskList.list.find((task) => task.name === taskName);
if (!task) {
return handlerInput.responseBuilder
.speak('Task not found')
.speak(MESSAGES.TASK_NOT_FOUND)
.getResponse();
}
const child = childList.list.find((child) => child.name === childName);
if (!child) {
return handlerInput.responseBuilder
.speak('Child not found')
.speak(MESSAGES.CHILD_NOT_FOUND)
.getResponse();
}
return TaskService.completeTask(task.id, child.id).then(() => {
return handlerInput.responseBuilder
.speak('Task completed')
.speak(MESSAGES.TASK_COMPLETED)
.getResponse();
}).catch(() => {
return handlerInput.responseBuilder
.speak('Task completion failed')
.speak(MESSAGES.ERROR_OCCURRED)
.getResponse();
});
}