-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
65 lines (58 loc) · 3.45 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* This sample demonstrates a simple skill built with the Amazon Alexa Skills
* nodejs skill development kit.
**/
const Alexa = require('alexa-sdk');
const FACTS = [
"I am going to tell you a fact from bhagvad geeta spoken by lord krishna in mahabharata yada yada hi dharmasya glanir bhavti bhartah abyuthanm adharmasya tadaatmaanam srijanyahamm paritranaay saadhunaam vinaashay cha dushkritaam dharma sansthapnaarthya sambhavaami yuge yuge means god says that whenever there is an occurence of lust,cheating, violence on earth then i come again and again and destroy all those bad evils and establish a fresh and pure life again on earth",
"Let me tell you about someone named Anand prabhakar.He is a student,web developer,data scientist and an active programmer he learns and practices html,css,js,python,java,go,sql,node-json,bootstrap,jquery and php and he loves exploring new things you can see more at anandprabhakarpersonal.co.nf",
"Do you know than i am made using a serverless application at lambda arn..and i can also be configured in echo dot devices i am amazon alexa i am the live example of artificial intelligence",",
"Earth is the only known planet till now that have life and we are very lucky that we belong from earth..The whole earth is family You are very lucky as you belong from earth because earth is a planet which have life",
"If you travel at speed of light for five years then you will be only five years older but you friends on earth will grow 65 years older",
"i am going to tell you a fact spoken by saige valmiki in ramayan,Mother and motherland is more great than the heaven",
"olympus mons on mars is largest known mountain in universe it is 16 times the height of mount everest",
"do you know that love is a feeling produced by a chemical released from brain when we see someone",
"Do you know rainbow can be seen circular from aeroplane but on earth we only see its half part",
"Do you konw kailash mountain is only mountain on which no one has climbed till now and strange fact is it is less in height than mount everest",
];
const SKILL_NAME = 'My School Facts';
const GET_FACT_MESSAGE = "Here's your school fact: ";
const HELP_MESSAGE = 'You can say tell me a fact, or, you can say exit... What can I help you with?';
const HELP_REPROMPT = 'What can I help you with?';
const STOP_MESSAGE = 'Goodbye!';
const handlers = {
'LaunchRequest': function () {
this.emit('GetFactIntent');
},
'GetFactIntent': function () {
const factArr = FACTS;
const factIndex = Math.floor(Math.random() * factArr.length);
const randomFact = factArr[factIndex];
const speechOutput = GET_FACT_MESSAGE + randomFact;
this.response.cardRenderer(SKILL_NAME, randomFact);
this.response.speak(speechOutput);
this.emit(':responseReady');
},
'SessionEndedRequest': function () {
},
'AMAZON.HelpIntent': function () {
const speechOutput = HELP_MESSAGE;
const reprompt = HELP_REPROMPT;
this.response.speak(speechOutput).listen(reprompt);
this.emit(':responseReady');
},
'AMAZON.CancelIntent': function () {
this.response.speak(STOP_MESSAGE);
this.emit(':responseReady');
},
'AMAZON.StopIntent': function () {
this.response.speak(STOP_MESSAGE);
this.emit(':responseReady');
},
};
exports.handler = function (event, context, callback) {
const alexa = Alexa.handler(event, context, callback);
alexa.appId = "amzn1.ask.skill.5df6ae05-94ef-4ed8-8235-71cabd6969fc";
alexa.registerHandlers(handlers);
alexa.execute();
};