Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RandomContent by time #14

Open
hideokamoto opened this issue Dec 14, 2018 · 0 comments
Open

RandomContent by time #14

hideokamoto opened this issue Dec 14, 2018 · 0 comments

Comments

@hideokamoto
Copy link
Collaborator

https://qiita.com/norippy_i/items/00ef01735e259f6d9502
こういうの。

        const date = new Date();
        const hours = date.getHours();
        const dayOfWeek = date.getDay();    // 曜日(数値)
        const dayOfWeekStr = ["日", "月", "火", "水", "木", "金", "土"][dayOfWeek];

        var greet = '';
        if (hours >= 5 && hours < 11) {
            greet = 'おはよう';
        } else if (hours >= 11 && hours < 17) {
            greet = 'こんにちは';
        } else {
            greet = 'こんばんは';
        }

        var speechOutput = ""
        speechOutput += greet + 'ダイビングログブックです。';

        if (dayOfWeekStr == '土' || dayOfWeekStr == '日') {//土日
            speechOutput += 'あら?ダイビングに行ってきたんですか?いいですね。'
        } else {
            speechOutput += '今日は' + dayOfWeekStr + '曜日。週末は海ですか?楽しみですね!'
        }
        speechOutput += 'それでは、何かご用件はございますか?'
        return handlerInput.responseBuilder
            .speak(speechOutput)
            .reprompt('何かご用件はございますか?') 
            .getResponse();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant