Ejemplo n.º 1
0
def test_text_format():
    assert "{}".format(ActionListen()) == "Action('action_listen')"
    assert (
        "{}".format(ActionUtterTemplate("my_action_name"))
        == "ActionUtterTemplate('my_action_name')"
    )
    assert (
        "{}".format(ActionRetrieveResponse("utter_test"))
        == "ActionRetrieveResponse('utter_test')"
    )
Ejemplo n.º 2
0
    async def send_text_message(self, recipient_id: Text, text: Text,
                                utter_action: Optional[Text],
                                **kwargs: Any) -> None:
        for message_part in text.strip().split("\n\n"):
            custom = None

            if utter_action:
                custom = {
                    "utter_action":
                    utter_action,
                    "intent":
                    ActionRetrieveResponse.intent_name_from_action(
                        utter_action),
                }
            await self._persist_message(
                self._message(recipient_id, text=message_part, custom=custom))