@ -747,7 +747,7 @@ class SectionComponent(Component):
payload: SectionComponentPayload = {
'type': self.type.value,
'components': [c.to_dict() for c in self.components],
'accessory': self.accessory.to_dict()
'accessory': self.accessory.to_dict(),
}
return payload
@ -79,10 +79,7 @@ class Section(Item[V]):
if len(children) > 3:
raise ValueError('maximum number of children exceeded')
self._children.extend(
[
c if isinstance(c, Item)
else TextDisplay(c) for c in children
],
[c if isinstance(c, Item) else TextDisplay(c) for c in children],
)
self.accessory: Item[Any] = accessory
@ -179,6 +176,6 @@ class Section(Item[V]):
data = {
'components': [c.to_component_dict() for c in self._children],
'accessory': self.accessory.to_component_dict()
'accessory': self.accessory.to_component_dict(),
return data
@ -23,7 +23,21 @@ DEALINGS IN THE SOFTWARE.
"""
from __future__ import annotations
from typing import Any, Callable, ClassVar, Coroutine, Dict, Iterator, List, Optional, Sequence, TYPE_CHECKING, Tuple, Type, Union
from typing import (
Any,
Callable,
ClassVar,
Coroutine,
Dict,
Iterator,
List,
Optional,
Sequence,
TYPE_CHECKING,
Tuple,
Type,
Union,
from functools import partial
from itertools import groupby