Last active
April 11, 2021 16:37
-
-
Save kinisoftware/a8123c0c9591aaa769414350e7cba5bb to your computer and use it in GitHub Desktop.
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
class NextIntentHandler : RequestHandler { | |
override fun canHandle(input: HandlerInput) = input.matches(intentName("AMAZON.NextIntent")) | |
override fun handle(input: HandlerInput) = | |
input.attributesManager.persistentAttributes["lastPlayedAudio"]?.let { | |
PlayAudioResponseBuilder.buildNewsResponse( | |
input, | |
Audio(it.toAudio().getNextDate()) | |
) | |
} ?: input.responseBuilder.build() | |
} | |
class PreviousIntentHandler : RequestHandler { | |
override fun canHandle(input: HandlerInput) = input.matches(intentName("AMAZON.PreviousIntent")) | |
override fun handle(input: HandlerInput) = | |
input.attributesManager.persistentAttributes["lastPlayedAudio"]?.let { | |
PlayAudioResponseBuilder.buildNewsResponse( | |
input, | |
Audio(it.toAudio().getPreviousDate()) | |
) | |
} ?: input.responseBuilder.build() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment