Last active
August 26, 2021 08:50
-
-
Save sjwaight/3985ff28fb6b42f5896d183243dea934 to your computer and use it in GitHub Desktop.
Sample Alexa Intent Handler written as a Python class.
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 ReadTopFiveItems(AbstractRequestHandler): | |
"""Handler for ReadTopFive Intent.""" | |
def can_handle(self, handler_input): | |
return ask_utils.is_intent_name("ReadTopFive")(handler_input) | |
def handle(self, handler_input): | |
logging.info("Called Skill Handler for ReadTopFive Intent.") | |
speak_output = "There are no new Azure items currently available for today." | |
ending = datetime.now() | |
starting = ending + timedelta(days=-7) | |
updatelist = get_updates_rss(startDate=starting,endDate=ending) | |
if len(updatelist) > 0: | |
speak_output = "Here are the most recent 5 Azure news items." | |
speak_output+= generate_list_respose(updatelist) | |
speak_output += " That's the most recent 5 announcements on Azure!" | |
return ( | |
handler_input.response_builder | |
.speak(speak_output) | |
.ask(speak_output) | |
.response | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment