deeppavlov.agents.rich_content

Rich content support implemented for various channels.

class deeppavlov.agents.rich_content.default_rich_content.Button(name: str, callback: str)[source]

Button with plain text callback.

Parameters:
  • name – Displayed name of the button.
  • callback – Plain text returned as callback when button pressed.
name

Displayed name of the button.

callback

Plain text returned as callback when button pressed.

json() → dict[source]

Returns json compatible state of the Button instance.

Returns:Json representation of Button state.
Return type:control_json
ms_bot_framework() → dict[source]

Returns MS Bot Framework compatible state of the Button instance.

Creates MS Bot Framework CardAction (button) with postBack value return.

Returns:MS Bot Framework representation of Button state.
Return type:control_json
class deeppavlov.agents.rich_content.default_rich_content.ButtonsFrame(text: Optional[str] = None)[source]

ButtonsFrame is a container for several Buttons objects.

ButtonsFrame embeds several Buttons and allows to post them in one channel message.

Parameters:text – Text displayed with embedded buttons.
text

Text displayed with embedded buttons.

content

Container with Button objects.

add_button(button: deeppavlov.agents.rich_content.default_rich_content.Button)[source]

Adds Button instance to RichMessage.

Parameters:button – Button instance.
json() → dict[source]

Returns json compatible state of the ButtonsFrame instance.

Returns json compatible state of the ButtonsFrame instance including all nested buttons.

Returns:Json representation of ButtonsFrame state.
Return type:control_json
ms_bot_framework() → dict[source]

Returns MS Bot Framework compatible state of the ButtonsFrame instance.

Creating MS Bot Framework activity blank with RichCard in “attachments”. RichCard is populated with CardActions corresponding buttons embedded in ButtonsFrame.

Returns:MS Bot Framework representation of ButtonsFrame state.
Return type:control_json
class deeppavlov.agents.rich_content.default_rich_content.PlainText(text: str)[source]

Plain text message as a rich control.

Parameters:text – Text of the message.
content

Text of the message.

json() → dict[source]

Returns json compatible state of the PlainText instance.

Returns:Json representation of PlainText state.
Return type:control_json
ms_bot_framework() → dict[source]

Returns MS Bot Framework compatible state of the PlainText instance.

Creating MS Bot Framework activity blank with “text” field populated.

Returns:MS Bot Framework representation of PlainText state.
Return type:control_json