Created
January 28, 2018 21:37
-
-
Save elbruno/9ee926b2f6bef58347c8d4abc57b13d2 to your computer and use it in GitHub Desktop.
AlexaSkillBrunoEventsAlexaSkillBrunoEvents.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace AlexaSkillBrunoEvents.Alexa | |
{ | |
public class AlexaSkillBrunoEvents : SpeechletAsync | |
{ | |
public override Task<SpeechletResponse> OnLaunchAsync(LaunchRequest launchRequest, Session session) | |
{ | |
return Task.FromResult(CompileResponse("Launch Event for Bruno Events")); | |
} | |
public async override Task<SpeechletResponse> OnIntentAsync(IntentRequest intentRequest, Session session) | |
{ | |
var message = new StringBuilder(); | |
message.Append($"Intent called {intentRequest.Intent}."); | |
if (intentRequest.Intent.Slots.Count > 0) | |
{ | |
message.Append($" Slots used. "); | |
foreach (var intentSlot in intentRequest.Intent.Slots) | |
message.Append($"{intentSlot.Key} "); | |
} | |
var response = CompileResponse(message.ToString()); | |
return await Task.FromResult(response); | |
} | |
public override Task OnSessionStartedAsync(SessionStartedRequest sessionStartedRequest, Session session) | |
{ | |
return Task.FromResult(0); | |
} | |
public override Task OnSessionEndedAsync(SessionEndedRequest sessionEndedRequest, Session session) | |
{ | |
return Task.FromResult(0); | |
} | |
public static SpeechletResponse CompileResponse(string output) | |
{ | |
var response = new SpeechletResponse | |
{ | |
OutputSpeech = new PlainTextOutputSpeech { Text = output }, | |
ShouldEndSession = true | |
}; | |
return response; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment