Add support for sending views in stateless webhooks

This commit is contained in:
DA344
2025-02-18 00:37:20 +01:00
committed by GitHub
parent 8edf433255
commit 6ab747f9e5
3 changed files with 42 additions and 13 deletions

View File

@ -214,6 +214,11 @@ class View:
# Wait N seconds to see if timeout data has been refreshed
await asyncio.sleep(self.__timeout_expiry - now)
def is_dispatchable(self) -> bool:
# this is used by webhooks to check whether a view requires a state attached
# or not, this simply is, whether a view has a component other than a url button
return any(item.is_dispatchable() for item in self.children)
def to_components(self) -> List[Dict[str, Any]]:
def key(item: Item) -> int:
return item._rendered_row or 0