static onIntent(intentRequest, session, callback) {

        console.log("IntentMap.onIntent requestId=" + intentRequest.requestId + ", sessionId=" + session.sessionId);

        // Check for a Close intent

        switch (intentRequest.intent.intentName) {
            case "Close":
                closeInteractiveSession(callback);
                return;

            case "AMAZON.HelpIntent":
                Help(session, callback);
                return;

            default:
                break;
        }

        // Connect to the squeeze server and wait for it to finish its registration

        var squeezeserver = new SqueezeServer(config.squeezeserverURL, config.squeezeserverPort, config.squeezeServerUsername, config.squeezeServerPassword);
        squeezeserver.on("register", function () {


            // Get the list of players as any request will require them

            squeezeserver.getPlayers(function (reply) {

                if (reply.ok) {

                    // We will get the persisted player name before dispatching the intent as all these intents required the player name

                    Persist.retrieve()
                           .then(result => IntentMap.dispatchIntent(squeezeserver, reply.result, intentRequest.intent, session, result.Items[0].Value.S, callback)).catch(err => IntentMap.dispatchIntent(squeezeserver, reply.result, intentRequest.intent, session, "", callback));
                } else {
                    callback(session.attributes, Utils.buildSpeechResponse("Get Players", "Failed to get list of players", null, true));
                }
            });
        });
    }
/**
     * Called when the user specifies an intent for this skill.
     *
     * @param intentRequest The full request
     * @param session The current session
     * @param callback A callback used to return results
     */
Called when the user specifies an intent for this skill.
@param intentRequest The full request
@param session The current session
@param callback A callback used to return results
Called when the user specifies an intent for this skill . @param intentRequest The full request @param session The current session @param callback A callback used to return results
static onIntent(intentRequest, session, callback) {
        console.log("IntentMap.onIntent requestId=" + intentRequest.requestId + ", sessionId=" + session.sessionId);
        switch (intentRequest.intent.intentName) {
            case "Close":
                closeInteractiveSession(callback);
                return;
            case "AMAZON.HelpIntent":
                Help(session, callback);
                return;
            default:
                break;
        }
        var squeezeserver = new SqueezeServer(config.squeezeserverURL, config.squeezeserverPort, config.squeezeServerUsername, config.squeezeServerPassword);
        squeezeserver.on("register", function () {
            squeezeserver.getPlayers(function (reply) {
                if (reply.ok) {
                    Persist.retrieve()
                           .then(result => IntentMap.dispatchIntent(squeezeserver, reply.result, intentRequest.intent, session, result.Items[0].Value.S, callback)).catch(err => IntentMap.dispatchIntent(squeezeserver, reply.result, intentRequest.intent, session, "", callback));
                } else {
                    callback(session.attributes, Utils.buildSpeechResponse("Get Players", "Failed to get list of players", null, true));
                }
            });
        });
    }
static onIntent ( intentRequest , session , callback ) { console . log ( "IntentMap.onIntent requestId=" + intentRequest . requestId + ", sessionId=" + session . sessionId ) ; switch ( intentRequest . intent . intentName ) { case "Close" : closeInteractiveSession ( callback ) ; return ; case "AMAZON.HelpIntent" : Help ( session , callback ) ; return ; default : break ; } var squeezeserver = new SqueezeServer ( config . squeezeserverURL , config . squeezeserverPort , config . squeezeServerUsername , config . squeezeServerPassword ) ; squeezeserver . on ( "register" , function ( ) { squeezeserver . getPlayers ( function ( reply ) { if ( reply . ok ) { Persist . retrieve ( ) . then ( result => IntentMap . dispatchIntent ( squeezeserver , reply . result , intentRequest . intent , session , result . Items [ 0 ] . Value . S , callback ) ) . catch ( err => IntentMap . dispatchIntent ( squeezeserver , reply . result , intentRequest . intent , session , "" , callback ) ) ; } else { callback ( session . attributes , Utils . buildSpeechResponse ( "Get Players" , "Failed to get list of players" , null , true ) ) ; } } ) ; } ) ; }
Called when the user specifies an intent for this skill.
Called when the user specifies an intent for this skill .
// Check for a Close intent // Connect to the squeeze server and wait for it to finish its registration // Get the list of players as any request will require them // We will get the persisted player name before dispatching the intent as all these intents required the player name