plain_text typed text object
| 71 | |
| 72 | |
| 73 | class PlainTextObject(TextObject): |
| 74 | """plain_text typed text object""" |
| 75 | |
| 76 | type = "plain_text" |
| 77 | |
| 78 | @property |
| 79 | def attributes(self) -> Set[str]: # type: ignore[override] |
| 80 | return super().attributes.union({"emoji"}) |
| 81 | |
| 82 | def __init__(self, *, text: str, emoji: Optional[bool] = None): |
| 83 | """A plain text object, meaning markdown characters will not be parsed as |
| 84 | formatting information. |
| 85 | https://docs.slack.dev/reference/block-kit/composition-objects/text-object |
| 86 | |
| 87 | Args: |
| 88 | text (required): The text for the block. This field accepts any of the standard text formatting markup |
| 89 | when type is mrkdwn. |
| 90 | emoji: Indicates whether emojis in a text field should be escaped into the colon emoji format. |
| 91 | This field is only usable when type is plain_text. |
| 92 | """ |
| 93 | super().__init__(text=text, type=self.type) |
| 94 | self.emoji = emoji |
| 95 | |
| 96 | @staticmethod |
| 97 | def from_str(text: str) -> "PlainTextObject": |
| 98 | return PlainTextObject(text=text, emoji=True) |
| 99 | |
| 100 | @staticmethod |
| 101 | def direct_from_string(text: str) -> Dict[str, Any]: |
| 102 | """Transforms a string into the required object shape to act as a PlainTextObject""" |
| 103 | return PlainTextObject.from_str(text).to_dict() |
| 104 | |
| 105 | |
| 106 | class MarkdownTextObject(TextObject): |
no outgoing calls