JAYA SHEELA
Created June 1, 2017

Bird Facts

A wonderful skill called Bird facts which tells you amazing unknown facts about THE GREATEST and BEAUTIFUL CREATION OF GOD - THE SWEET BIRDS

Intermediate4 hours18
Bird Facts

Things used in this project

Story

Read more

Schematics

How Bird Facts works?

Code

code snippet

Tex
/*JESUS IS LORD*/
/* eslint-disable  func-names */
/* eslint quote-props: ["error", "consistent"]*/
/**
 * This sample demonstrates a simple skill built with the Amazon Alexa Skills
 * nodejs skill development kit.
 * This sample supports multiple lauguages. (en-US, en-GB, de-DE).
 * The Intent Schema, Custom Slots and Sample Utterances for this skill, as well
 * as testing instructions are located at https://github.com/alexa/skill-sample-nodejs-fact
 **/

'use strict';

const Alexa = require('alexa-sdk');

const APP_ID = undefined;  // TODO replace with your app ID (OPTIONAL).

const languageStrings = {
    'en-GB': {
        translation: {
            FACTS: [
               "	The chicken is the closest living relative to the Tyrannosaurus Rex.	", 
"	Many birds kept as pets, including doves, parakeets, and lovebirds, enjoy living in pairs for companionship.	", 
"	The smallest bird egg belongs to the hummingbird and is the size of a pea.  The largest bird egg, from which the ostrich hatches, is the size of a cantaloupe.	", 
"	A bird’s eye takes up about 50 percent of its head; our eyes take up about 5 percent of our head. To be comparable to a bird’s eyes, our eyes would have to be the size of baseballs.	", 
"	The penguin is the only bird that can swim, but not fly. It is also the only bird that walks upright.	", 
"	Owls turn their heads almost 360○ (a complete circle) but they cannot move their eyes.	", 
"	Chickens have over 200 distinct noises they make for communicating.	", 
"	When it comes to birds, the males tend to have the more glamorous feather shape, coloration, songs, and dances.  Female birds choose their mate based on how attractive they find them!	", 
"	It is estimated that one third of all bird owners turn on a radio for their pet when they leave the house.	", 
"	According to National Geographic, scientists have an answer for the age old dispute over which came first, the chicken or the egg.  Reptiles were laying eggs thousands of years before chickens appeared.  The first chicken came from an egg laid by a bird that was not quite a chicken.  Therefore, the egg came first.	", 
"	The first bird domesticated by humans was the goose.	", 
"	Kiwi birds are blind, so they hunt by smell.	", 
"	Some breeds of chickens can lay colored eggs. The Ameraucana and Araucana can lay green or blue eggs.	", 
"	The common phrase “eat like a bird” should mean something quite different!  Many birds eat twice their weight in food each day.  In fact, a bird requires more food in proportion to its size than a baby or a cat.	", 
"	A group of larks is called an exaltation, a group of chickens is called a peep, a group of geese is called a gaggle, a group of ravens is called a murder, and a group of owls is called a parliament.	", 
"	Chickens that lay brown eggs have red ear lobes. There is a genetic link between the two.	", 
"	Crows have the largest cerebral hemispheres (brains), relative to body size, of any avian family.	", 
"	Mockingbirds can imitate many sounds, from a squeaking door to a cat meowing.	"
 ],
            SKILL_NAME: 'British Bird Facts',
            GET_FACT_MESSAGE: "Here's your fact: ",
            HELP_MESSAGE: 'You can say tell me a bird fact, or, you can say exit... What can I help you with?',
            HELP_REPROMPT: 'What can I help you with?',
            STOP_MESSAGE: 'Goodbye!',
        },
    },
    'en-US': {
        translation: {
            FACTS: [
              "	The chicken is the closest living relative to the Tyrannosaurus Rex.	", 
"	Many birds kept as pets, including doves, parakeets, and lovebirds, enjoy living in pairs for companionship.	", 
"	The smallest bird egg belongs to the hummingbird and is the size of a pea.  The largest bird egg, from which the ostrich hatches, is the size of a cantaloupe.	", 
"	A bird’s eye takes up about 50 percent of its head; our eyes take up about 5 percent of our head. To be comparable to a bird’s eyes, our eyes would have to be the size of baseballs.	", 
"	The penguin is the only bird that can swim, but not fly. It is also the only bird that walks upright.	", 
"	Owls turn their heads almost 360○ (a complete circle) but they cannot move their eyes.	", 
"	Chickens have over 200 distinct noises they make for communicating.	", 
"	When it comes to birds, the males tend to have the more glamorous feather shape, coloration, songs, and dances.  Female birds choose their mate based on how attractive they find them!	", 
"	It is estimated that one third of all bird owners turn on a radio for their pet when they leave the house.	", 
"	According to National Geographic, scientists have an answer for the age old dispute over which came first, the chicken or the egg.  Reptiles were laying eggs thousands of years before chickens appeared.  The first chicken came from an egg laid by a bird that was not quite a chicken.  Therefore, the egg came first.	", 
"	The first bird domesticated by humans was the goose.	", 
"	Kiwi birds are blind, so they hunt by smell.	", 
"	Some breeds of chickens can lay colored eggs. The Ameraucana and Araucana can lay green or blue eggs.	", 
"	The common phrase “eat like a bird” should mean something quite different!  Many birds eat twice their weight in food each day.  In fact, a bird requires more food in proportion to its size than a baby or a cat.	", 
"	A group of larks is called an exaltation, a group of chickens is called a peep, a group of geese is called a gaggle, a group of ravens is called a murder, and a group of owls is called a parliament.	", 
"	Chickens that lay brown eggs have red ear lobes. There is a genetic link between the two.	", 
"	Crows have the largest cerebral hemispheres (brains), relative to body size, of any avian family.	", 
"	Mockingbirds can imitate many sounds, from a squeaking door to a cat meowing.	"  ],
            SKILL_NAME: 'American Bird Facts',
            GET_FACT_MESSAGE: "Here's your fact: ",
            HELP_MESSAGE: 'You can say tell me a Bird fact, or, you can say exit... What can I help you with?',
            HELP_REPROMPT: 'What can I help you with?',
            STOP_MESSAGE: 'Goodbye!',
        },
    },
    
};

const handlers = {
    'LaunchRequest': function () {
        this.emit('GetFact');
    },
    'GetNewFactIntent': function () {
        this.emit('GetFact');
    },
    'GetFact': function () {
        // Get a random space fact from the space facts list
        // Use this.t() to get corresponding language data
        const factArr = this.t('FACTS');
        const factIndex = Math.floor(Math.random() * factArr.length);
        const randomFact = factArr[factIndex];

        // Create speech output
        const speechOutput = this.t('GET_FACT_MESSAGE') + randomFact;
        this.emit(':tellWithCard', speechOutput, this.t('SKILL_NAME'), randomFact);
    },
    'AMAZON.HelpIntent': function () {
        const speechOutput = this.t('HELP_MESSAGE');
        const reprompt = this.t('HELP_MESSAGE');
        this.emit(':ask', speechOutput, reprompt);
    },
    'AMAZON.CancelIntent': function () {
        this.emit(':tell', this.t('STOP_MESSAGE'));
    },
    'AMAZON.StopIntent': function () {
        this.emit(':tell', this.t('STOP_MESSAGE'));
    },
    'SessionEndedRequest': function () {
        this.emit(':tell', this.t('STOP_MESSAGE'));
    },
};

exports.handler = (event, context) => {
    const alexa = Alexa.handler(event, context);
    alexa.APP_ID = APP_ID;
    // To enable string internationalization (i18n) features, set a resources object.
    alexa.resources = languageStrings;
    alexa.registerHandlers(handlers);
    alexa.execute();
};

Credits

JAYA SHEELA

JAYA SHEELA

0 projects • 0 followers

Comments