Exemplo n.º 1
0
def MaraudersSessionEndedRequest(session):
    """
    Default End Session Intent
    ---
    mischief managed
    """
    return ResponseBuilder.create_response()
Exemplo n.º 2
0
def SoundCheck(session):
    """
    ---
    the soundcheck
    """
    message = "Check. Check. Check one two.  Can everyone here me alright?"
    return ResponseBuilder.create_response(message=message, end_session=True)
Exemplo n.º 3
0
def MaraudersSessionEndedRequest(session):
    """
    Default End Session Intent
    ---
    mischief managed
    """
    return ResponseBuilder.create_response()
Exemplo n.º 4
0
def Terminology(session):
    """
    ---
    terminology is so important
    """
    message = "Terminology is very important because when we say, utterance, and you get a mental picture of rinseing a cows utter... we are going to have a problem."
    return ResponseBuilder.create_response(message=message, end_session=True)
Exemplo n.º 5
0
def passOption(session, number=-1, alexa_option=""):
    """
         option passing
        ---
        pass option {alexa_option} to block {number}
        option {alexa_option} block {number}
        block {number} option {alexa_option}
    """

    print("\033[93m", number, alexa_option, "\033[0m")
    num = number
    SessChain = consumers.getSessChain()
    if type(num) is int:
        if num < SessChain.getBlockListLength():
            block = SessChain.getBlock(num)
            try:
                block.getOption(alexa_option, num)
                msg = "processed"
            except:
                print("\033[93mUnexpected error:", sys.exc_info(), "\033[0m")
                msg = "error processing block" + str(num)
        else:
            msg = "Block with number " + str(
                num) + " does not exist. Maximum block number is " + str(
                    SessChain.getBlockListLength() - 1)
    else:
        print("\033[94m Amazon provided None type \033[0m")
        msg = "Please provide a number"

    return ResponseBuilder.create_response(message=msg,
                                           reprompt="",
                                           end_session=False,
                                           launched=True)
Exemplo n.º 6
0
def AddForm(session, searchphrase=''):
    pair_examples = []
    curr_index = [[]]
    #    f = open('/home/perkins/candle/pairs.txt','r')
    #for line in f:
    #   pair_examples[0]=list(line)
    #   pair_examples[0]=list(f.read())
    print('AAATTTRRR!!!!!!', session.keys(), session)
    pair_examples = str(session['attributes']['attributes']['pair_examples'])
    pair_examples = ast.literal_eval(pair_examples)
    answer = ast.literal_eval(
        str(session['attributes']['attributes']['answers']))
    #pair_examples=[n.strip() for n in pair_examples]
    curr_index[0] = int(session['attributes']['attributes']['curr_index'])
    #    ci = open('/home/perkins/candle/curr_index.txt','r')
    #    for line in ci:
    #       curr_index[0]=int(line)
    #   curr_index[0]=int(line)
    print("khgbwygweifgi@@@@@@@@@", pair_examples)
    print("khhviv%%%%%%%%%%%%%%%%%%", curr_index)
    print(searchphrase)
    kwargs = {}
    index_copy = curr_index[0]
    answer.append(searchphrase)
    kwargs['attributes'] = {}
    kwargs['attributes']['answers'] = str(answer)
    if index_copy >= len(pair_examples) - 2:
        kwargs['message'] = str(
            pair_examples[index_copy][0]) + " has been filled. Form complete."
        kwargs['end_session'] = True
        print("uyfyfuy&&&&&&&&&&&&", kwargs['attributes']['answers'])
    else:
        kwargs['message'] = str(
            pair_examples[index_copy][0]) + " has been filled. Next is " + str(
                pair_examples[index_copy + 1][0])
        kwargs['end_session'] = False
    curr_index[0] += 1
    #answer.append(searchphrase)
    #kwargs['attributes']={}
    kwargs['attributes']['curr_index'] = str(curr_index[0])
    kwargs['attributes']['pair_examples'] = str(pair_examples)
    #kwargs['attributes']['answers']=str(answer)
    #kwargs['attributes']['a']
    #    cw = open('/home/perkins/candle/curr_index.txt','w')
    #   write(str(curr_index[0])
    # cw.close()
    #    ci.close()
    if True or session.get('launched'):
        session['reprompt'] = "Please mention the proper phrases..."
        session['end_session'] = False
        session['shouldEndSession'] = False
        session['launched'] = True  #session['launched']

        #kwargs['reprompt'] = "Please mention the phrase for the form."
        #kwargs['end_session'] = False
        kwargs['shouldEndSession'] = False
        kwargs['launched'] = True  #session['launched']

    return ResponseBuilder.create_response(**kwargs)
Exemplo n.º 7
0
def LaunchRequest(session):
    """
    ---
    launch
    """
    message = "Welcome to TopOPPS!"
    reprompt = "What can I help you with today?"
    return ResponseBuilder.create_response(message=message, reprompt=reprompt, end_session=False, launched=True)
Exemplo n.º 8
0
def DemoTimeOver(session):
    """
    ---
    demo time is over
    """
    message = "That's it?  Not very impressive, if you ask me..."
    return ResponseBuilder.create_response(message=message, message_is_ssml=True,
                                           end_session=True)
Exemplo n.º 9
0
def AddPointsToHouse(session, house, points):
    kwargs = {}
    kwargs['message'] = "{0} points added to house {1}.".format(points, house)
    if session.get('launched'):
        kwargs['reprompt'] = "What house would you like to give points to?"
        kwargs['end_session'] = False
        kwargs['launched'] = session['launched']
    return ResponseBuilder.create_response(**kwargs)
Exemplo n.º 10
0
def Terminology(session):
    """
    ---
    terminology is so important
    """
    message = "Terminology is very important because when we say, utterance, and you get a mental picture of rinseing a cows utter... we are going to have a problem."
    return ResponseBuilder.create_response(message=message,
                                           end_session=True)
Exemplo n.º 11
0
def LaunchRequest(session):
    message = 'Loading Jarvis. <audio src="https://alexa.rocktavious.com/static/jarvis/voice/calibrating.mp3" />'
    message += '<audio src="https://alexa.rocktavious.com/static/jarvis/voice/utilization.mp3" />'
    message += '<audio src="https://alexa.rocktavious.com/static/jarvis/voice/uploaded.mp3" />'
    reprompt = '<audio src="https://alexa.rocktavious.com/static/jarvis/voice/what_to_do.mp3" />'
    return ResponseBuilder.create_response(message=message, message_is_ssml=True,
                                           reprompt=reprompt, reprompt_is_ssml=True,
                                           end_session=False)
Exemplo n.º 12
0
def DemoTime(session):
    """
    ---
    it is demo time
    """
    message = "Its Demo time? <p>I love Demo time. Dem Dem Demo Time.</p>"
    return ResponseBuilder.create_response(message=message, message_is_ssml=True,
                                           end_session=True)
Exemplo n.º 13
0
def SoundCheck(session):
    """
    ---
    the soundcheck
    """
    message = "Check. Check. Check one two.  Can everyone here me alright?"
    return ResponseBuilder.create_response(message=message,
                                           end_session=True)
Exemplo n.º 14
0
def HousePartyProtocol(session):
    """
    ---
    you know what to do
    """
    message = '<audio src="https://alexa.rocktavious.com/static/jarvis/voice/house_party_protocol.mp3" />'
    return ResponseBuilder.create_response(message=message, message_is_ssml=True,
                                           end_session=False,
                                           house_party=1)
Exemplo n.º 15
0
def DemoTime(session):
    """
    ---
    it is demo time
    """
    message = "Its Demo time? <p>I love Demo time. Dem Dem Demo Time.</p>"
    return ResponseBuilder.create_response(message=message,
                                           message_is_ssml=True,
                                           end_session=True)
Exemplo n.º 16
0
def DemoTimeOver(session):
    """
    ---
    demo time is over
    """
    message = "That's it?  Not very impressive, if you ask me..."
    return ResponseBuilder.create_response(message=message,
                                           message_is_ssml=True,
                                           end_session=True)
Exemplo n.º 17
0
def StopIntent(session):
    """
    Default help intent
    ---
    help
    info
    information
    """
    message = "Good Bye!"
    return ResponseBuilder.create_response(message=message)
Exemplo n.º 18
0
def SessionEndedRequest(**kwargs):
    """
    Default End Session Intent
    ---
    quit
    end
    """
    print("End called")
    consumers.AlexaEnded()
    return ResponseBuilder.create_response()
Exemplo n.º 19
0
def HousePartyProtocol(session):
    """
    ---
    you know what to do
    """
    message = '<audio src="https://alexa.rocktavious.com/static/jarvis/voice/house_party_protocol.mp3" />'
    return ResponseBuilder.create_response(message=message,
                                           message_is_ssml=True,
                                           end_session=False,
                                           house_party=1)
Exemplo n.º 20
0
def HelpIntent(session):
    """
    Default help intent
    ---
    help
    info
    information
    """
    message = "Using our skill you can simplify network management."
    return ResponseBuilder.create_response(message=message)
Exemplo n.º 21
0
def LaunchRequest(session):
    message = 'Loading Jarvis. <audio src="https://alexa.rocktavious.com/static/jarvis/voice/calibrating.mp3" />'
    message += '<audio src="https://alexa.rocktavious.com/static/jarvis/voice/utilization.mp3" />'
    message += '<audio src="https://alexa.rocktavious.com/static/jarvis/voice/uploaded.mp3" />'
    reprompt = '<audio src="https://alexa.rocktavious.com/static/jarvis/voice/what_to_do.mp3" />'
    return ResponseBuilder.create_response(message=message,
                                           message_is_ssml=True,
                                           reprompt=reprompt,
                                           reprompt_is_ssml=True,
                                           end_session=False)
Exemplo n.º 22
0
def Introduction(session):
    """
    ---
    introduction
    """
    message = "Thanks for that wonderful introduction Joe! Welcome ladies and gentleman to the first awpug of twenty sixteen."
    message += " I'm hopeful this will be an exciting year, for me, and for the internet of things."
    message += " I look forward to all of you developing my guts and working on your skills, for thats what makes any developer a great developer,"
    return ResponseBuilder.create_response(message=message,
                                           end_session=False,
                                           long_winded=1)
Exemplo n.º 23
0
def LaunchRequest(session):
    """
    B 2 S Lab is a go
    ---
    Launch
    """
    consumers.AlexaActive()
    return ResponseBuilder.create_response(message="open",
                                           reprompt="",
                                           end_session=False,
                                           launched=True)
Exemplo n.º 24
0
def Introduction(session):
    """
    ---
    introduction
    """
    message = "Thanks for that wonderful introduction Joe! Welcome ladies and gentleman to the first awpug of twenty sixteen."
    message += " I'm hopeful this will be an exciting year, for me, and for the internet of things."
    message += " I look forward to all of you developing my guts and working on your skills, for thats what makes any developer a great developer,"
    return ResponseBuilder.create_response(message=message,
                                           end_session=False,
                                           long_winded=1)
Exemplo n.º 25
0
def LaunchRequest(session):
    """
    ---
    launch
    """
    message = "Welcome to Hog warts school of witchcraft and wizardry!"
    reprompt = "What house would you like to give points to?"
    return ResponseBuilder.create_response(message=message,
                                           reprompt=reprompt,
                                           end_session=False,
                                           launched=True)
Exemplo n.º 26
0
def MaraudersLaunchRequest(session):
    """
    ---
    i solemnly swear i am up to no good
    """
    message = "Messers Moony, Wormtail, Padfoot and Prongs are proud to present the Marauders Map!"
    reprompt = "What mischief brings you here?"
    return ResponseBuilder.create_response(message=message,
                                           reprompt=reprompt,
                                           end_session=False,
                                           marauder=True)
Exemplo n.º 27
0
def MaraudersLaunchRequest(session):
    """
    ---
    i solemnly swear i am up to no good
    """
    message = "Messers Moony, Wormtail, Padfoot and Prongs are proud to present the Marauders Map!"
    reprompt = "What mischief brings you here?"
    return ResponseBuilder.create_response(message=message,
                                           reprompt=reprompt,
                                           end_session=False,
                                           marauder=True)
Exemplo n.º 28
0
def LaunchRequest(session):
    """
    ---
    launch
    """
    message = "Welcome to Hog warts school of witchcraft and wizardry!"
    reprompt = "What house would you like to give points to?"
    return ResponseBuilder.create_response(message=message,
                                           reprompt=reprompt,
                                           end_session=False,
                                           launched=True)
Exemplo n.º 29
0
def StopRequest(session):
    """
    ---
    yes
    """
    kwargs = {}
    house_party = session.get('house_party')
    if house_party:
        kwargs["message"] = '<audio src="https://alexa.rocktavious.com/static/jarvis/voice/house_party_song.mp3" />'
        kwargs["message_is_ssml"] = True
    return ResponseBuilder.create_response(**kwargs)
Exemplo n.º 30
0
def BestOpportunities(session):
    """
    The 3 best opportunities
    ---
    What are my top opportunities
    """
    message = "Your top 3 opportunities are as follows."
    message += " 1. United Oil Workers. Currently in Pending and marked as Commit, expected to close on December 12, 2012."
    message += " 2. United Oil Workers. Currently in Pending and marked as Commit, expected to close on December 12, 2012."
    message += " 3. United Oil Workers. Currently in Pending and marked as Commit, expected to close on December 12, 2012."
    return ResponseBuilder.create_response(message=message)
Exemplo n.º 31
0
def UnforgivableCurses(session):
    """
    The 3 unforgivable curses
    ---
    What are the unforgivable curses
    """
    message = "The Unforgivable Curses are three of the most powerful and sinister spells known to the wizarding world. "
    count = 0
    for curse_name, curse_word in CURSES.items():
        count += 1
        message += " {0}. {1}. Cast by saying, {2}. ".format(str(count), curse_name, curse_word)
    return ResponseBuilder.create_response(message=message)
Exemplo n.º 32
0
def StopRequest(session):
    """
    ---
    yes
    """
    kwargs = {}
    house_party = session.get('house_party')
    if house_party:
        kwargs[
            "message"] = '<audio src="https://alexa.rocktavious.com/static/jarvis/voice/house_party_song.mp3" />'
        kwargs["message_is_ssml"] = True
    return ResponseBuilder.create_response(**kwargs)
Exemplo n.º 33
0
def PointsForHouse(session, points, house):
    """
    Direct response to add points to a house
    ---
    {house}
    {points}
    {points} {house}
    {points} points {house}
    add {points} points to {house}
    give {points} points to {house}
    """
    kwargs = {}
    kwargs['launched'] = launched = session.get('launched')
    kwargs['marauder'] = marauder = session.get('marauder')
    kwargs['points'] = points = points or session.get('points')
    kwargs['house'] = house = house or session.get('house')
    if points is None:
        kwargs['message'] = "How many points?".format(house)
        kwargs["end_session"] = False
        return ResponseBuilder.create_response(**kwargs)
    if house is None:
        kwargs['message'] = "Which house?".format(points)
        kwargs["end_session"] = False
        return ResponseBuilder.create_response(**kwargs)
    if marauder:
        kwargs[
            'message'] = "messers can not give points to houses, we lose them in the name of mischief!"
        kwargs['message'] += " {0} points removed from house {1}.".format(
            randint(1, 10), house or HOUSES[randint(0, 3)])
        kwargs['reprompt'] = "What mischief brings you here?"
        kwargs['end_session'] = False
    else:
        if launched:
            kwargs['reprompt'] = "What house would you like to give points to?"
            kwargs['end_session'] = False
        kwargs['message'] = "{0} points added to house {1}.".format(
            points, house)
        kwargs.pop("house")
        kwargs.pop("points")
    return ResponseBuilder.create_response(**kwargs)
Exemplo n.º 34
0
def UnforgivableCurses(session):
    """
    The 3 unforgivable curses
    ---
    What are the unforgivable curses
    """
    message = "The Unforgivable Curses are three of the most powerful and sinister spells known to the wizarding world. "
    count = 0
    for curse_name, curse_word in CURSES.items():
        count += 1
        message += " {0}. {1}. Cast by saying, {2}. ".format(
            str(count), curse_name, curse_word)
    return ResponseBuilder.create_response(message=message)
Exemplo n.º 35
0
def LaunchRequest(session):
    """
    Hogwarts is a go
    ---
    launch
    start
    run
    begin
    open
    """
    return ResponseBuilder.create_response(message="Welcome to Hog warts school of witchcraft and wizardry!",
                                           reprompt="What house would you like to give points to?",
                                           end_session=False,
                                           launched=True)
Exemplo n.º 36
0
def EnoughAlready(session):
    """
    ---
    enough already
    """
    kwargs = {}
    if session.get("long_winded") == 1:
        kwargs["message"] = "I'm sorry.  I was just trying to give everyone a warm welcome and be nice to the host and our audience so that you can give a good presentation."
        kwargs["long_winded"] = 2
        kwargs["end_session"] = False
    elif session.get("long_winded") == 2:
        kwargs["message"] = "fine, i'll shut up now."
        kwargs["end_session"] = True
    return ResponseBuilder.create_response(**kwargs)
Exemplo n.º 37
0
def PointsForHouse(session, points, house):
    """
    Direct response to add points to a house
    ---
    {house}
    {points}
    {points} {house}
    {points} points {house}
    add {points} points to {house}
    give {points} points to {house}
    """
    kwargs = {}
    kwargs['launched'] = launched = session.get('launched')
    kwargs['marauder'] = marauder = session.get('marauder')
    kwargs['points'] = points = points or session.get('points')
    kwargs['house'] = house = house or session.get('house')
    if points is None:
        kwargs['message'] = "How many points?".format(house)
        kwargs["end_session"] = False
        return ResponseBuilder.create_response(**kwargs)
    if house is None:
        kwargs['message'] = "Which house?".format(points)
        kwargs["end_session"] = False
        return ResponseBuilder.create_response(**kwargs)
    if marauder:
        kwargs['message'] = "messers can not give points to houses, we lose them in the name of mischief!"
        kwargs['message'] += " {0} points removed from house {1}.".format(randint(1,10), house or HOUSES[randint(0, 3)])
        kwargs['reprompt'] = "What mischief brings you here?"
        kwargs['end_session'] = False
    else:
        if launched:
            kwargs['reprompt'] = "What house would you like to give points to?"
            kwargs['end_session'] = False
        kwargs['message'] = "{0} points added to house {1}.".format(points, house)
        kwargs.pop("house")
        kwargs.pop("points")
    return ResponseBuilder.create_response(**kwargs)
Exemplo n.º 38
0
def EnoughAlready(session):
    """
    ---
    enough already
    """
    kwargs = {}
    if session.get("long_winded") == 1:
        kwargs[
            "message"] = "I'm sorry.  I was just trying to give everyone a warm welcome and be nice to the host and our audience so that you can give a good presentation."
        kwargs["long_winded"] = 2
        kwargs["end_session"] = False
    elif session.get("long_winded") == 2:
        kwargs["message"] = "fine, i'll shut up now."
        kwargs["end_session"] = True
    return ResponseBuilder.create_response(**kwargs)
Exemplo n.º 39
0
def LaunchRequest(session):
    """
    Default launch Intent
    ---
    launch
    start
    """
    logging.info("Launching Intent Invoked")
    kwargs = {}
    kwargs['message'] = "Welcome to ViVoNet."
    kwargs[
        'reprompt'] = "Which intent would you like to setup? You can say least latency, least hopcount or high bandwidth"
    kwargs["end_session"] = False
    kwargs["launched"] = True
    return ResponseBuilder.create_response(**kwargs)
Exemplo n.º 40
0
def LaunchRequest(session):
    """
    ---
    launch
    start
    run
    begin
    """
    # return ResponseBuilder.create_response(message="Hello! Let's fill some forms together.",
    #                                       reprompt="What form do you want me to open? It can be a description or a URL.",
    #                                       end_session=False,
    #                                       launched=True)
    return ResponseBuilder.create_response(message="Hi",
                                           reprompt="",
                                           end_session=False,
                                           launched=True)
Exemplo n.º 41
0
def showImg(session, num=0):
    """
        showing the block with number X in new tab
        ---
        show block {num}
        show {num}
        {num} show
        show
        show larger block {num}
        show larger {num}
        {num} show larger
        show larger
        larger
        enlarge
        enlarge block {num}
        enlarge {num}
        {num} enlarge
    """
    print("woop", num)
    SessChain = consumers.getSessChain()

    print("inside BLOCK: ")
    print(SessChain)

    if type(num) is int:
        if num < SessChain.getBlockListLength():
            msg = "showing block " + str(num)
            try:
                SessChain.getBlock(num).showBlock(num)
            except:
                msg = "function not available for block " + str(num)
        else:
            msg = "Block with number " + str(
                num) + " does not exist. Maximum block number is " + str(
                    SessChain.getBlockListLength() - 1)
    else:
        print("\033[94m Amazon provided " + str(type(num)) + " type \033[0m")
        try:
            SessChain.getBlock(-1).showBlock()
            msg = "showing last block"
        except:
            msg = "Function not available for last block"

    return ResponseBuilder.create_response(message=msg,
                                           reprompt="",
                                           end_session=False,
                                           launched=True)
Exemplo n.º 42
0
def LaunchRequest(session):
    """
    Starting the news app
    ---
    launch
    start
    run
    begin
    open
    """

    print "LAUNCHREQUEST"
    return ResponseBuilder.create_response(
        message="Welcome to Kicker... ... ...What can I help you with?",
        #    reprompt="What can I help you with?",
        end_session=False,
        launched=True)
Exemplo n.º 43
0
def loadFile(session, num=0):
    """
        loading file with number {num}
        ---
        read file {num}
        read {num}
        {num} read
        load file {num}
        load {num}
        {num} load
        file {num}
        {num} file  
    """
    print("loading", num)
    FileList = consumers.getFileList()
    print(FileList)

    if type(num) is int:
        if num < len(FileList):
            try:
                SessChain = consumers.getSessChain()
                print("got Chain")
                IO = IO_Block(file_name=FileList[num], session="alexa")
                print("NEW IO BLOCK")
                SessChain.addBlock(IO)
                print("added to Chain:")

                print(SessChain)
                Group("alexa").send({"text": IO.GetNode()})
                SessChain.Chain_pickle()
                msg = "File " + str(num) + " successfully loaded"
            except:
                print("\033[93mUnexpected error:", sys.exc_info(), "\033[0m")
                msg = "error loading file  " + str(num)
        else:
            msg = "File with number " + str(
                num) + " does not exist. Maximum File number is " + str(
                    len(FileList) - 1)
    else:
        print("\033[94m Amazon provided None type \033[0m")
        msg = "Please provide a number"

    return ResponseBuilder.create_response(message=msg,
                                           reprompt="",
                                           end_session=False,
                                           launched=True)
Exemplo n.º 44
0
def minimize(session):
    """
    minimizes after show Block
    ---
    minimize
    make small
    hide
    back
    """
    data = {
        "type": "cmd",
        "cmd": "minimize",
    }
    Group("alexa").send({"text": json.dumps(data)})
    return ResponseBuilder.create_response(message="",
                                           reprompt="",
                                           end_session=False,
                                           launched=True)