Skip to content

Instantly share code, notes, and snippets.

View kinisoftware's full-sized avatar

Joaquin Engelmo Moriche kinisoftware

View GitHub Profile
class PlaybackFailureHandler : RequestHandler {
override fun canHandle(input: HandlerInput) =
input.matches(Predicates.requestType(PlaybackFailedRequest::class.java))
override fun handle(input: HandlerInput): Optional<Response> {
val request = input.requestEnvelope.request
val intentRequest = request as PlaybackFailedRequest
return when (intentRequest.error.type) {
class PlaybackStartedHandler : RequestHandler {
override fun canHandle(input: HandlerInput) =
input.matches(Predicates.requestType(PlaybackStartedRequest::class.java))
override fun handle(input: HandlerInput) = input.responseBuilder.build()
}
override fun handle(input: HandlerInput) = input.responseBuilder
.addAudioPlayerStopDirective()
.withShouldEndSession(true)
.build()
return input.responseBuilder
.addAudioPlayerPlayDirective(
PlayBehavior.REPLACE_ALL,
OL,
null,
"audioSkill",
"https://skill-chistes.s3.[region].amazonaws.com/chiste-[n].mp3"
)
.build()
{
"name": "PlayTheVideoIntent",
"slots": [],
"samples": [
"pon el video",
"reproduce el video",
"dale al play"
]
}
{
"body": {
"version": "1.0",
"response": {
"directives": [
{
"type": "AudioPlayer.Play",
"playBehavior": "REPLACE_ALL",
"audioItem": {
"stream": {
{
"name": "PlayTheAudioIntent",
"slots": [],
"samples": [
"pon algo",
"pon el audio",
"el audio",
"algo"
]
}
"footerData": {
"type": "object",
"objectId": "footerData",
"properties": {
"hintText": "siguiente estreno"
},
"transformers": [
{
"inputPath": "hintText",
"transformer": "textToHint"
@kinisoftware
kinisoftware / AlexaFooter.js
Created October 26, 2020 09:00
AlexaFooter.js
{
"type": "AlexaFooter",
"hintText": "${hintText}",
"when": "${viewport.shape != 'round'}"
}
@kinisoftware
kinisoftware / NextPageIntentHandler.kt
Created October 22, 2020 17:09
NextPageIntentHandler
class NextPageIntentHandler : RequestHandler {
override fun canHandle(input: HandlerInput): Boolean {
return input.supportAPL() && input.matches(Predicates.intentName("NextPageIntent"))
}
override fun handle(input: HandlerInput): Optional<Response> {
val directive = ExecuteCommandsDirective.builder()
.withToken("newReleasesSkillAPLToken")
.addCommandsItem(SetPageCommand.builder()
.withComponentId("moviesPager")