-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lambda Function
40 lines (40 loc) · 19.7 KB
/
Lambda Function
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
'use strict';
const Alexa = require('alexa-sdk');
const RandomFunFacts = ['Butterflies cannot fly if their body temperature is less than 86 degrees.','Neurons multiply at a rate 250,000 neurons per minute during early pregnancy.', 'Elephants have the longest pregnancy in the animal kingdom at 22 months. ', 'The longest human pregnancy on record is 17 months, 11 days.', 'A female oyster produces 100 million young in her lifetime, the typical hen lays 19 dozen eggs a year, and it is possible for one female cat to be responsible for the birth of 20,736 kittens in four years.', 'Michelle Druggar holds the record for largest human family, having given birth to 17 children.', '750ml of blood pumps through your brain every minute which is 15 to 20% of blood flow from the heart.', 'The human brain is about 75% water.', 'Dragonflies are capable of flying sixty miles per hour, making them one of the fastest insects. This is good since they are in a big hurry, as they only live about twenty-four hours.', 'Flies jump backwards during takeoff.', 'A housefly will regurgitate its food and eat it again and so does a cow.', 'Termites outweigh humans by almost ten to one.', "A spider's web is not a home, but rather a trap for its food. They are as individual as snowflakes, with no two ever being the same. Some tropical spiders have built webs over eighteen feet across.", 'More people are afraid of spiders than death. Amazingly, few people are afraid of Champagne corks even though you are more likely to be killed by one than by a spider.', 'Your brain consumes 25 watts of power while you’re awake. This amount of energy is enough to illuminate a lightbulb.', 'It is impossible to lick your elbow.', 'Intelligent people have more zinc and copper in their hair.', 'In every episode of Seinfeld there is a Superman somewhere.', 'Possums have one of the shortest pregnancies at 16 days. ', 'The shortest human pregnancy to produce a healthy baby was 22 weeks, 6 days and the baby was the length of a ballpoint pen.', 'Wearing headphones for just an hour will increase the bacteria in your ear by 700 times.', "The most poisonous spider is the black widow. Its venom is more potent than a rattlesnake's.", '13% of Americans actually believe that some parts of the moon are made of cheese.', "The world's youngest parents were 8 and 9 and lived in China in 1910.", "Fish that live more than 800 meters below the ocean surface don't have eyes.", 'Butterflies range in size from a tiny 1/8 inch to a huge almost 12 inches.', 'Most household dust is made of dead skin cells.', 'One in eight million people has progeria, a disease that causes people to grow faster than they age.', 'The male seahorse carries the eggs until they hatch instead of the female.', 'Negative emotions such as anxiety and depression can weaken your immune system.', 'Stephen Hawking was born exactly 300 years after Galileo died.', 'Mercury is the only planet whose orbit is coplanar with its equator.', "The Morgan's Sphinx Moth from Madagascar has a proboscis (tube mouth) that is 12 to 14 inches long to get the nectar from the bottom of a 12 inch deep orchid discovered by Charles Darwin.", "Some moths never eat anything as adults because they don't have mouths. They must live on the energy they stored as caterpillars.", 'Grapes explode when you put them in the microwave. Go on, try it then.', 'Peanuts are one of the ingredients of dynamite.', "The average chocolate bar has 8 insects' legs in it.", 'In York, it is perfectly legal to shoot a Scotsman with a bow and arrow (except on Sundays)', 'No piece of square dry paper can be folded in half more than 7 times.', 'The average human eats 8 spiders in their lifetime at night.', '"Stewardesses" is the longest word typed with only the left hand.', 'An average human loses about 200 head hairs per day.', 'Mexico City sinks about 10 inches a year.', "It's impossible to sneeze with your eyes open.", 'In France, a five year old child can buy an alcoholic drink in a bar.', 'During the chariot scene in "Ben Hur," a small red car can be seen in the distance.', 'Because metal was scarce, the Oscars given out during World War II were made of wood.', 'By raising your legs slowly and lying on your back, you cannot sink into quicksand.', 'The glue on Israeli postage is certified kosher.', "In 10 minutes, a hurricane releases more energy than all of the world's nuclear weapons combined.", 'On average, 100 people choke to death on ball-point pens every year.', 'Thirty-five percent of the people who use personal ads for dating are already married.', 'The electric chair was invented by a dentist.', 'The top butterfly flight speed is 12 miles per hour. Some moths can fly 25 miles per hour!', 'The Brimstone butterfly (Gonepterix rhamni) has the longest lifetime of the adult butterflies: 9-10 months.', 'Bruce Lee was so fast that they actually had to slow film down so you could see his moves.', "A Boeing 747s wingspan is longer than the Wright brother's first flight.", 'Representations of butterflies are seen in Egyptian frescoes at Thebes, which are 3,500 years old.', "Babies are born without knee caps. They don't appear until the child reaches 2-6 years of age.", '14% of all facts and statistics are made up and 27% of people know that fact.', "Every time you lick a stamp, you're consuming 1/10 of a calorie.", "Eskimos have over 15 words for the English word of 'Snow'", 'Butterflies can see red, green, and yellow.', 'Some people say that when the black bands on the Woolybear caterpillar are wide, a cold winter is coming.', 'Americans on the average eat 18 acres of pizza every day.', 'Banging your head against a wall uses 150 calories an hour.', 'Almonds are a member of the peach family.', 'The plastic things on the end of shoelaces are called aglets.', 'There are no clocks in Las Vegas gambling casinos.', 'Coconuts kill about 150 people each year. That’s more than sharks.', 'Half of all bank robberies take place on a Friday.', 'The name Wendy was made up for the book Peter Pan. There was never a recorded Wendy before it.', 'The international telephone dialing code for Antarctica is 672.', 'The first bomb the Allies dropped on Berlin in WWII killed the only elephant in the Berlin Zoo.', 'The average raindrop falls at 7 miles per hour.', 'If you put a drop of liquor on a scorpion, it will instantly go mad and sting itself to death.', 'The first CD pressed in the US was Bruce Springsteen’s “Born in the USA”.', 'IBM’s motto is “Think”. Apple later made their motto “Think different”.', 'The original name for butterfly was flutterby.', 'One in fourteen women in America is a natural blonde. Only one in sixteen men is.', 'The Olympic was the sister ship of the Titanic, and she provided twenty-five years of service.', 'When the Titanic sank, 2228 people were on it. Only 706 survived.', 'Every day, 7% of the US eats at McDonald’s.', 'During his entire life, Vincent Van Gogh sold exactly one painting, “Red Vineyard at Arles”.', 'One in ten people live on an island.', 'It takes more calories to eat a piece of celery than the celery has in it to begin with.', '28% of Africa is classified as wilderness. In North America, its 38%.', 'Charlie Chaplin once won third prize in a Charlie Chaplin look-alike contest.', 'Chewing gum while peeling onions will keep you from crying.', 'Sherlock Holmes NEVER said “Elementary, my dear Watson”.', 'Humphrey Bogart NEVER said “Play it again, Sam” in Casablanca.', 'They NEVER said “Beam me up, Scotty” on Star Trek.', 'Sharon Stone was the first Star Search spokes model.', 'More people are afraid of open spaces (kenophobia) than of tight spaces (claustrophobia).', 'There is a 1 in 4 chance that New York will have a white Christmas.', 'The Guinness Book of Records holds the record for being the book most often stolen from Libraries.', 'Thirty-five percent of the people who use personal ads for dating are already married.', 'Every US president has worn glasses (just not always in public).', 'Bats always turn left when exiting a cave.', 'Jim Henson first coined the word “Muppet”. It is a combination of “marionette” and “puppet.”', 'The Michelin man is known as Mr. Bib. His name was Bibendum in the company’s first ads in 1896.', 'The word “lethologica” describes the state of not being able to remember the word you want.', 'About 14% of injecting drug users are HIV positive.', 'A word or sentence that is the same front and back (racecar, kayak) is called a “palindrome”.', 'A snail can sleep for 3 years.', 'People photocopying their buttocks are the cause of 23% of all photocopier faults worldwide.', 'China has more English speakers than the United States.', 'One in every 9000 people is an albino.', 'There are about a million ants per person. Ants are very social animals and will live in colonies that can contain almost 500,000 ants.', 'You share your birthday with at least 9 million other people in the world.', 'Everyday, more money is printed for Monopoly sets than for the U.S. Treasury.', 'Every year 4 people in the UK die putting their trousers on.', 'Cats have over one hundred vocal sounds; dogs only have about ten.', 'Our eyes are always the same size from birth but our nose and ears never stop growing.', 'Rats multiply so quickly that in 18 months, two rats could have over million descendants.', 'Each year in America there are about 300,000 deaths that can be attributed to obesity.', "Many butterflies can taste with their feet to find out whether the leaf they sit on is good to lay eggs on to be their caterpillars' food or not.", 'There are more types of insects in one tropical rain forest tree than there are in the entire state of Vermont.', 'About 55% of all movies are rated R.', 'About 500 movies are made in the US and 800 in India annually.', 'Arabic numerals are not really Arabic; they were created in India.', 'The February of 1865 is the only month in recorded history not to have a full moon.', 'There is actually no danger in swimming right after you eat, though it may feel uncomfortable.', 'The cruise liner Queen Elizabeth II moves only six inches for each gallon of diesel that it burns.', 'More than 50% of the people in the world have never made or received a telephone call.', 'A shark is the only fish that can blink with both eyes.', 'There are about 2 chickens for every human in the world.', 'The word “maverick” came into use after Samuel Maverick, a Texan refused to brand his cattle.', 'Two-thirds of the world’s eggplant is grown in New Jersey.', 'Termites have been known to eat food twice as fast when heavy metal music is playing.', 'There are more beetles than any other animal. In fact, one out of every four animals is a beetle.', "The moon is moving away from the Earth at a tiny, although measurable, rate every year. 85 million years ago it was orbiting the Earth about 35 feet from the planet's surface.", 'The star Antares is 60,000 times larger than our sun. If our sun were the size of a softball, the star Antares would be as large as a house.', 'In Calama, a town in the Atacama Desert of Chile, it has never rained.', "At any given time, there are 1,800 thunderstorms in progress over the earth's atmosphere.", 'Erosion at the base of Niagara Falls has caused the falls to recede approximately seven miles over the past 10,000 years.', 'A ten-year-old mattress weighs double what it did when it was new due to debris that it absorbs over time. That debris includes dust mites (their droppings and decaying bodies), mold, millions of dead skin cells, dandruff, animal and human hair, secretions, excretions, lint, pollen, dust, soil, sand, and a lot of perspiration, which the average person loses at a rate of a quart a day. Good night!', 'Every year 16 million gallons of oil runs off pavement into streams, rivers, and eventually, oceans in the United States. This is more oil than was spilled by the Exxon Valdez.', "In space, astronauts cannot cry because there is no gravity and tears can't flow.", 'Most lipstick contains fish scales.', 'A "jiffy" is an actual unit of time: 1/100th of a second.', 'If you have three quarters, four dimes, and four pennies you have $1.19. you also have the largest possible amount of money in coins without being able to make change for a dollar.', 'Leonardo Da Vinci invented scissors.', 'Recycling one glass jar saves enough energy to operate a television for three hours.', 'The cigarette lighter was invented before the match.', 'The main library at Indiana University sinks over an inch a year. When it was designed engineers failed to take into account the weight of all the books that would occupy the building.', 'There is enough fuel in full jumbo jet tank to drive an average car four times around the world.', 'An average of 100 people choke to death on ballpoint pens every year.', 'Antarctica is the only continent without reptiles or snakes.', 'San Francisco cable cars are the only National Monuments that can move.', 'February 1865 is the only month in recorded history not to have a full moon.', 'Nutmeg is extremely poisonous if injected intravenously.', 'A rainbow can be seen only in the morning or late afternoon. It can occur only when the sun is 40 degrees or less above the horizon.', 'Lightning strikes the Earth 100 times every second.', 'La Paz, Bolivia has an average annual temperature below 50 degrees Fahrenheit. However, it has never recorded a zero-degree temperature. Same for Stanley, the Falkland Islands, and Punta Arenas, Chile.', 'There are over 87,000 Americans on waiting lists for organ transplants.', 'Catsup leaves the bottle at a rate of 25 miles per year.', 'Toxic house plants poison more children than household chemicals do.', 'You are more likely to be infected by flesh-eating bacteria than you are to be struck by lightning.', 'According to Genesis 1:20-22, the chicken came before the egg.', 'There is a company that will (for $14,000) take your ashes and compress them into a synthetic diamond to be set in jewelry for a loved one.', 'There are more living organisms on the skin of a single human being than there are human beings on the surface of the earth.', 'The longest bout of hiccups lasted nearly 69 years.', 'Men can read smaller print than women. Women can hear better.', 'If you sneeze too hard you can fracture a rib. If you try to suppress a sneeze you can rupture a blood vessel in your head or neck and die. If you keep your eyes open by force they can pop out.', 'A kiss stimulates 29 muscles and chemicals that cause relaxation. Women seem to like light and frequent kisses while men like them more strenuous.', 'Our eyes are always the same size from birth, but our nose and ears never stop growing.', 'The average person falls asleep in seven minutes.', 'Almost everyone who reads this will try to lick their elbow.', 'According to Chinese acupuncture, there is a point on the head that you can press to control your appetite. It is located in the hollow just in front of the flap of the ear.', 'In a recent survey, Americans revealed that banana was their favorite smell.', "A shrimp's heart is in its head.", 'A snail can sleep for three years.', "The chicken is one of the few things that man eats before it's born and after it's dead.", "Some dogs can predict when a child will have an epileptic seizure and even protect the child from injury. They're not trained to do this, they simply learn to respond after observing at least one attack.", 'A pregnant goldfish is called a twit.', 'Rats multiply so quickly that in 18 months, two rats could have over a million descendants.', 'There are only three types of snakes on the island of Tasmania and all three are deadly poisonous.', 'It is physically impossible for pigs to look up into the sky.', 'Dolphins sleep with one eye open.', 'A goldfish has a memory span of three seconds.', 'Emus and kangaroos cannot walk backwards and are on the Australian coat of arms for that reason.', 'The jellyfish is 95% water.', 'A hippo can open its mouth wide enough to fit a 4 foot tall child inside.', 'Only female mosquitoes bite.', 'Most elephants weigh less than the tongue of the blue whale.', 'The youngest pope was 11 years old.', 'Richard Versalle, a tenor performing at New York\'s Metropolitan Opera House, suffered a heart attack and fell 10 feet from a ladder to the stage just after singing the line, "You can only live so long."', '60.7 percent of eligible voters participated in the 2004 presidential election, the highest percentage in 36 years. However, more than 78 million did not vote. This means President Bush was re-elected by less than 31% of all eligible voters in the United States.', 'David Bowie used to think he was being stalked by someone who is dressed like a giant pink rabbit. Bowie noticed the fan at several recent concerts, but became alarmed when he got on a plane and the bunny was also on board.', 'Dr. Samuel A. Mudd was the physician who set the leg of Lincoln\'s assassin, John Wilkes Booth, and whose shame created the expression for ignominy: "His name is Mudd."', "Wayne's World was filmed in two weeks.", 'The first Fords had engines made by Dodge.', 'In Ancient Egypt , priests plucked every hair from their bodies, including their eyebrows and eyelashes.', 'More than 8,100 US troops are still listed as missing in action from the Korean War.', 'As of January 1, 2004, the population of the United States increases by one person every 12 seconds. There is a birth every eight seconds, an immigrant is added every 25 seconds, and a death every 13 seconds.', 'Inn the great fire of 1666, half of London was burnt down but only six people were injured.', 'Toto was paid $125 per week while filming The Wizard of Oz.', 'The only member of the band ZZ Top without a beard has the last name Beard.', 'In Egypt around 1500 B.C., a shaved head was considered the ultimate in feminine beauty. Egyptian women removed every hair from their heads with special gold tweezers and polished their scalps to a high sheen with buffing cloths.', "George Lumley, aged 104, married Mary Dunning, aged 10, in Nortallerton, England on August 25, 1783. She was the great-great granddaughter of the woman who'd broken her engagement to Lumley, eighty years before.", 'In Elizabethan England, the spoon was so novel and prized that people carried their own folding spoons to banquets.', 'It costs more to buy a new car today in the United States than it cost Christopher Columbus to equip and undertake three voyages to and from the New World.', 'Ancient Egyptians slept on pillows made of stone.', 'Millie the White House dog earned more than four times as President Bush in 1991.', 'A law passed in Nebraska in 1912 set hard rules of the road. Drivers in the country at night were required to stop every 150 yards, send up a skyrocket, then wait eight minutes for the road to clear before proceeding cautiously, all the while blowing their horn and shooting off flares.']
const handlers = {
'LaunchRequest': function () {
this.emit(':ask', 'Hello, would you like a fun fact?', 'Would you like a fun fact?'); },
DeliverFact: function () {
this.emit('GetFact');
},
'GetFact': function () {
const factIndex = Math.floor(Math.random() * RandomFunFacts.length);
const randomFact = RandomFunFacts [factIndex];
const anotherFact = 'Would you like another fact?';
this.emit(':ask', `${randomFact}, ${anotherFact}`, anotherFact);
},
'AMAZON.HelpIntent': function () {
const helpMessage = 'You can ask me for a random fact';
this.emit(':ask', helpMessage, helpMessage);
},
'AMAZON.YesIntent': function () {
this.emit('GetFact');
},
'AMAZON.NoIntent': function () {
this.emit(':tell', 'Goodbye');
},
'AMAZON.CancelIntent': function () {
this.emit(':tell', 'Goodbye');
},
'AMAZON.StopIntent': function () {
this.emit(':tell', 'Goodbye');
},
'SessionEndedRequest': function () {
this.emit(':tell', 'Goodbye');
}
};
exports.handler = (event, context) => {
const alexa = Alexa.handler(event, context);
alexa.registerHandlers(handlers);
alexa.execute();
};