Communicators#

Communicators

This code provides communicator objects for formatting Module output for

display for Web or Alexa requests.

class lambdaHandlers.communicators.AlexaCommunicator#

AlexaCommunicator Class

build_reply(module)#

Build the Reply

>>> import random
>>> random.seed(13)
>>> # build module
>>> from lambdaHandlers.modules import Npc
>>> module = Npc("", "grassland")
>>> # display module output for Alexa
>>> comm = AlexaCommunicator()
>>> comm.build_reply(module)
'A centaur confronts you!\n\nWould you like another N P C?'
get_error_message(error)#

Standard error message

class lambdaHandlers.communicators.Communicator#

Communicator base class

abstract build_reply()#

Build the Reply

class lambdaHandlers.communicators.WebCommunicator#

WebCommunicator Class

build_reply(module)#

Build the Reply

>>> import random
>>> random.seed(13)
>>> # build module
>>> from lambdaHandlers.modules import Monster
>>> module = Monster("", "swamp")
>>> # display module output for web
>>> comm = WebCommunicator()
>>> comm.build_reply(module)
'--- Random Monster ---\ntroll - HP: 131-145'
get_error_message(error)#

Standard error message