Speak
The Carter API does not return an audio URL by default as this introduces latency. carter-js mimicks this behaviour. By default, carter-js will pass speak=false
to the api, and interaction.outputAudio
will be null.
There are two ways to override this behaviour.
Class Level
const carter = new Carter(apiKey, logger, speak=True)
When the speak
parameter is set to true on class creation, every request to carter will pass speak=True
by default. Think of this as setting the default.
Request Level
const interaction = carter.say(text, playerId, speak=False)
When the speak
parameter is passed to a function call, it will override the default on the class. This is true whether speak
has been overriden on class creation or left to the default false
.
This allows you to choose a default, and break from this with each request.
Last updated