MCPcopy Index your code
hub / github.com/slackapi/python-slack-sdk / ActionsBlock

Class ActionsBlock

slack_sdk/models/blocks/blocks.py:302–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300
301
302class ActionsBlock(Block):
303 type = "actions"
304 elements_max_length = 25
305
306 @property
307 def attributes(self) -> Set[str]: # type: ignore[override]
308 return super().attributes.union({"elements"})
309
310 def __init__(
311 self,
312 *,
313 elements: Sequence[Union[dict, InteractiveElement]],
314 block_id: Optional[str] = None,
315 **others: dict,
316 ):
317 """A block that is used to hold interactive elements.
318 https://docs.slack.dev/reference/block-kit/blocks/actions-block
319
320 Args:
321 elements (required): An array of interactive element objects - buttons, select menus, overflow menus,
322 or date pickers. There is a maximum of 25 elements in each action block.
323 block_id: A string acting as a unique identifier for a block.
324 If not specified, a block_id will be generated.
325 You can use this block_id when you receive an interaction payload to identify the source of the action.
326 Maximum length for this field is 255 characters.
327 block_id should be unique for each message and each iteration of a message.
328 If a message is updated, use a new block_id.
329 """
330 super().__init__(type=self.type, block_id=block_id)
331 show_unknown_key_warning(self, others)
332
333 self.elements = BlockElement.parse_all(elements)
334
335 @JsonValidator(f"elements attribute cannot exceed {elements_max_length} elements")
336 def _validate_elements_length(self):
337 return self.elements is None or len(self.elements) <= self.elements_max_length
338
339
340class ContextBlock(Block):

Callers 12

test_with_blocksMethod · 0.90
test_with_blocksMethod · 0.90
test_document_1Method · 0.90
test_document_2Method · 0.90
test_jsonMethod · 0.90
test_element_parsingMethod · 0.90
test_document_1Method · 0.90
test_document_2Method · 0.90
test_jsonMethod · 0.90
parseMethod · 0.85

Calls

no outgoing calls

Tested by 11

test_with_blocksMethod · 0.72
test_with_blocksMethod · 0.72
test_document_1Method · 0.72
test_document_2Method · 0.72
test_jsonMethod · 0.72
test_element_parsingMethod · 0.72
test_document_1Method · 0.72
test_document_2Method · 0.72
test_jsonMethod · 0.72