mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 09:26:10 +00:00
Add content_length method to LayoutView and container items
This commit is contained in:
@ -281,6 +281,12 @@ class Container(Item[V]):
|
||||
if child._has_children():
|
||||
yield from child.walk_children() # type: ignore
|
||||
|
||||
def content_length(self) -> int:
|
||||
""":class:`int`: Returns the total length of all text content in this container."""
|
||||
from .text_display import TextDisplay
|
||||
|
||||
return sum(len(item.content) for item in self.walk_children() if isinstance(item, TextDisplay))
|
||||
|
||||
def add_item(self, item: Item[Any]) -> Self:
|
||||
"""Adds an item to this container.
|
||||
|
||||
|
Reference in New Issue
Block a user