MetaView
Published © CC0

Schmiss Norrländer Fakten

Schmiss Norrländer Fakten is an Alexa Fact Skill which presents the user with some random facts about the inglorious Schmiss Norrländer.

BeginnerShowcase (no instructions)1 hour509
Schmiss Norrländer Fakten

Things used in this project

Hardware components

Amazon Echo
Amazon Alexa Amazon Echo
×1

Story

Read more

Code

Alexa skill code

JavaScript
nodejs
/* 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 = { 
   'de-DE': { 
       translation: { 
           FACTS: [ 
               'Schmiss Norrländer isst einen Elefanten zum Frühstück und hat danach noch Hunger.', 
               'Wenn Schmiss Norrländer einkaufen geht, ist sein Einkaufskorb schon zu Hause, bevor er bezahlt hat.', 
               'Schmiss Norrländer Haus hat 100 Ankleidezimmer, er sucht jeden Morgen 4 Stunden nach seinen Hosen.', 
               'Schmiss Norrländer trocknet sich nach dem Baden nicht ab, das Wasser flieht vor ihm von alleine.', 
               'Schmiss Norrländer traf einmal auf ein Krokodil, am nächsten Morgen hat ihm das Krokodil die Brötchen geschmiert.', 
               'Schmiss Norrländer und ein Löwe sind in einem Auto eingesperrt, eine Stunde später steigen ein Lamm und Schmiss Norrländer in einem Löwenkostüm aus.', 
               'Wenn Schmiss Norrländer zur Arbeit geht, hat sich die Arbeit schon erledigt, bevor er überhaupt ankommt.', 
               'Über Schmiss Norrländer macht man keine Witze. Alles was man von ihm hört, ist wahr.', 
               'Schmiss Norrländer soll wirklich ein Schauspieler sein.', 
               'Schmiss Norrländer Gegner ist schon k.o., bevor er zum Schlag ausholt.', 
               'Schmiss Norrländer sieht aus wie mein Bruder, nur mit mehr Haare und weniger Bauch.', 
               'Schmiss Norrländer braucht keine Genehmigung für Alexa Echo, Alexa Echo muss Schmiss Norrländer um Erlaubnis fragen.', 
               'Schmiss Norrländer liest keine Bücher. Er starrt sie an, bis sie die Informationen preisgeben, die er haben will.', 
           ], 
           SKILL_NAME: 'Schmiss Norrländer Fakten', 
           GET_FACT_MESSAGE: 'Hier ist ein ausgesuchter Fakt: ', 
           HELP_MESSAGE: 'Du kannst sagen, „Nenne mir einen Fakt über Schmiss Norrländer“, oder du kannst „Beenden“ sagen... Wie kann ich dir helfen?', 
           HELP_REPROMPT: 'Wie kann ich dir helfen?', 
           STOP_MESSAGE: 'Auf Wiedersehen!', 
       }, 
   }, 
}; 
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(); 
};  

The code

C/C++
/* 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 = { 
   'de-DE': { 
       translation: { 
           FACTS: [ 
               'Schmiss Norrländer isst einen Elefanten zum Frühstück und hat danach noch Hunger.', 
               'Wenn Schmiss Norrländer einkaufen geht, ist sein Einkaufskorb schon zu Hause, bevor er bezahlt hat.', 
               'Schmiss Norrländer Haus hat 100 Ankleidezimmer, er sucht jeden Morgen 4 Stunden nach seinen Hosen.', 
               'Schmiss Norrländer trocknet sich nach dem Baden nicht ab, das Wasser flieht vor ihm von alleine.', 
               'Schmiss Norrländer traf einmal auf ein Krokodil, am nächsten Morgen hat ihm das Krokodil die Brötchen geschmiert.', 
               'Schmiss Norrländer und ein Löwe sind in einem Auto eingesperrt, eine Stunde später steigen ein Lamm und Schmiss Norrländer in einem Löwenkostüm aus.', 
               'Wenn Schmiss Norrländer zur Arbeit geht, hat sich die Arbeit schon erledigt, bevor er überhaupt ankommt.', 
               ber Schmiss Norrländer macht man keine Witze. Alles was man von ihm hört, ist wahr.', 
               'Schmiss Norrländer soll wirklich ein Schauspieler sein.', 
               'Schmiss Norrländer Gegner ist schon k.o., bevor er zum Schlag ausholt.', 
               'Schmiss Norrländer sieht aus wie mein Bruder, nur mit mehr Haare und weniger Bauch.', 
               'Schmiss Norrländer braucht keine Genehmigung für Alexa Echo, Alexa Echo muss Schmiss Norrländer um Erlaubnis fragen.', 
               'Schmiss Norrländer liest keine Bücher. Er starrt sie an, bis sie die Informationen preisgeben, die er haben will.', 
           ], 
           SKILL_NAME: 'Schmiss Norrländer Fakten', 
           GET_FACT_MESSAGE: 'Hier ist ein ausgesuchter Fakt: ', 
           HELP_MESSAGE: 'Du kannst sagen, Nenne mir einen Fakt über Schmiss Norrländer, oder du kannst Beenden sagen... Wie kann ich dir helfen?', 
           HELP_REPROMPT: 'Wie kann ich dir helfen?', 
           STOP_MESSAGE: 'Auf Wiedersehen!', 
       }, 
   }, 
}; 
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

MetaView

MetaView

8 projects • 15 followers

Comments