Skip to content

Commit 00faca4

Browse files
authored
attrs
1 parent 090af2e commit 00faca4

File tree

9 files changed

+21
-33
lines changed

9 files changed

+21
-33
lines changed

discord/components.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def __init__(self, data: ComponentPayload):
176176

177177
@property
178178
def width(self):
179-
"""Return the sum of the item's widths."""
179+
"""Return the sum of the items' widths."""
180180
t = 0
181181
for item in self.children:
182182
t += 1 if item.type is ComponentType.button else 5

discord/ui/file.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ def __init__(self, url: str, *, spoiler: bool = False, id: int | None = None):
5858
def type(self) -> ComponentType:
5959
return self._underlying.type
6060

61-
@property
62-
def width(self) -> int:
63-
return 5
64-
6561
@property
6662
def url(self) -> str:
6763
"""The URL of this file's media. This must be an ``attachment://`` URL that references a :class:`~discord.File`."""

discord/ui/input_text.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,6 @@ def value(self, value: str | None):
228228
raise ValueError("value must be 4000 characters or fewer")
229229
self._underlying.value = value
230230

231-
@property
232-
def width(self) -> int:
233-
return 5
234-
235231
def to_component_dict(self) -> InputTextComponentPayload:
236232
return self._underlying.to_dict()
237233

discord/ui/label.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,9 @@ class Label(Item[V]):
4242
item: :class:`Item`
4343
The initial item in this label.
4444
label: :class:`str`
45-
The label text.
46-
Must be 45 characters or fewer.
45+
The label text. Must be 45 characters or fewer.
4746
description: Optional[:class:`str`]
48-
The description for this label.
49-
Must be 100 characters or fewer.
47+
The description for this label. Must be 100 characters or fewer.
5048
id: Optional[:class:`int`]
5149
The label's ID.
5250
"""
@@ -254,6 +252,24 @@ def view(self, value):
254252
def type(self) -> ComponentType:
255253
return self._underlying.type
256254

255+
@property
256+
def label(self) -> str:
257+
"""The label text. Must be 45 characters or fewer."""
258+
return self._underlying.label
259+
260+
@label.setter
261+
def label(self, value: str) -> None:
262+
self._underlying.label = value
263+
264+
@property
265+
def description(self) -> str | None:
266+
"""The description for this label. Must be 100 characters or fewer."""
267+
return self._underlying.description
268+
269+
@description.setter
270+
def description(self, value: str | None) -> None:
271+
self._underlying.description = value
272+
257273
def is_dispatchable(self) -> bool:
258274
return self.item.is_dispatchable()
259275

discord/ui/media_gallery.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,6 @@ def view(self, value):
113113
def type(self) -> ComponentType:
114114
return self._underlying.type
115115

116-
@property
117-
def width(self) -> int:
118-
return 5
119-
120116
def to_component_dict(self) -> MediaGalleryComponentPayload:
121117
return self._underlying.to_dict()
122118

discord/ui/section.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,6 @@ def copy_text(self) -> str:
251251
def type(self) -> ComponentType:
252252
return self._underlying.type
253253

254-
@property
255-
def width(self) -> int:
256-
return 5
257-
258254
def is_dispatchable(self) -> bool:
259255
return self.accessory and self.accessory.is_dispatchable()
260256

discord/ui/separator.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ def spacing(self) -> SeparatorSpacingSize:
7777
def spacing(self, value: SeparatorSpacingSize) -> None:
7878
self._underlying.spacing = value
7979

80-
@property
81-
def width(self) -> int:
82-
return 5
83-
8480
def to_component_dict(self) -> SeparatorComponentPayload:
8581
return self._underlying.to_dict()
8682

discord/ui/text_display.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ def content(self) -> str:
6262
def content(self, value: str) -> None:
6363
self._underlying.content = value
6464

65-
@property
66-
def width(self) -> int:
67-
return 5
68-
6965
def to_component_dict(self) -> TextDisplayComponentPayload:
7066
return self._underlying.to_dict()
7167

discord/ui/thumbnail.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ def __init__(
6666
def type(self) -> ComponentType:
6767
return self._underlying.type
6868

69-
@property
70-
def width(self) -> int:
71-
return 5
72-
7369
@property
7470
def url(self) -> str:
7571
"""The URL of this thumbnail's media. This can either be an arbitrary URL or an ``attachment://`` URL."""

0 commit comments

Comments
 (0)