| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- # -*- coding: utf-8 -*-
- from __future__ import print_function, absolute_import, division
- from flask import Flask
- from flask_ask import Ask, statement, question, session
- import json
- import time
- from random import choice
- app = Flask(__name__)
- ask = Ask(app, "/ameise")
- # the Links:
- # Config: https://developer.amazon.com/edw/home.html#/skills
- # Docs: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/supported-phrases-to-begin-a-conversation
- WELCOME = [
- 'Hast du einen Wunsch?',
- 'Kann ich dir helfen?',
- 'Was soll ich tun?',
- 'Ja?',
- 'Steht was an?',
- 'Was gibt es?',
- 'Hast du eine Frage?',
- 'Gib mir einen Befehl',
- ]
- REPROMPTS = [
- 'Was hast du gesagt?',
- 'Ich habe dich nicht verstanden!',
- 'Sprich deutlich, dann verstehe ich dich auch!',
- 'Nuscheln ist nicht erlaubt!',
- 'Was meinst du?',
- ]
- @app.route('/')
- def homepage():
- return "Hi there, how ya doin?"
- @ask.launch
- def start_skill():
- print('Welcome ...')
- return question(choice(WELCOME)).reprompt(choice(REPROMPTS))
- @ask.intent("ChefIntent")
- def declare_chef():
- names = ['Lilith', 'Elise', 'Lars', 'Annelie', 'Mama', 'Papa',
- 'Christine', 'Dirk', 'Lillutschka', 'Larsi', 'Liselchen', 'Annelutschka',
- 'Annelie Rothe', 'Lilith Rothe', 'Christine Rothe', 'Lars Rothe', 'Elise Rothe',
- 'die kleine Annelie', 'der schnelle Lars', 'die schlaue Elise', 'die intelligente Lilith']
- chefs = ['Chef', 'Oberchef', 'Boss', 'Bestimmer', 'Meister',
- 'Leiter', 'Direktor', u'Anführer', 'Oberboss', u'König']
- s = ('%s ist heute der %s, aber morgen ist %s dran!' %
- (choice(names), choice(chefs), choice(names)))
- return statement(s.encode('utf-8'))
- @ask.intent("LeaveIntent")
- def no_intent():
- choices = [
- 'Ok, das ist aber schade, Auf Wiedersehen.',
- 'Gut, bis zum nächsten Mal.',
- 'Ok, selten so viel Spass gehabt.',
- ]
- return statement(choice(choices))
- if __name__ == '__main__':
- app.run(debug=True, host='0.0.0.0', port=80)
|