Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AlexaSkillBrunoEventsAlexaSkillBrunoEvents.cs
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
You can’t perform that action at this time.