Skip to content

Commit 78ff166

Browse files
committed
Fix certain component IDs not being able to be settable afterwards
Fix #10305
1 parent c050ed0 commit 78ff166

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

discord/ui/file.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,15 @@ def __init__(
100100
spoiler=bool(spoiler),
101101
id=id,
102102
)
103-
self.id = id
103+
104+
@property
105+
def id(self) -> Optional[int]:
106+
"""Optional[:class:`int`]: The ID of this file component."""
107+
return self._underlying.id
108+
109+
@id.setter
110+
def id(self, value: Optional[int]) -> None:
111+
self._underlying.id = value
104112

105113
def _is_v2(self):
106114
return True

discord/ui/separator.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ def __init__(
8383
def _is_v2(self):
8484
return True
8585

86+
@property
87+
def id(self) -> Optional[int]:
88+
"""Optional[:class:`int`]: The ID of this separator."""
89+
return self._underlying.id
90+
91+
@id.setter
92+
def id(self, value: Optional[int]) -> None:
93+
self._underlying.id = value
94+
8695
@property
8796
def visible(self) -> bool:
8897
""":class:`bool`: Whether this separator is visible.

discord/ui/text_input.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,19 @@ def __init__(
144144
id=id,
145145
)
146146
self.row = row
147-
self.id = id
148147

149148
def __str__(self) -> str:
150149
return self.value
151150

151+
@property
152+
def id(self) -> Optional[int]:
153+
"""Optional[:class:`int`]: The ID of this text input."""
154+
return self._underlying.id
155+
156+
@id.setter
157+
def id(self, value: Optional[int]) -> None:
158+
self._underlying.id = value
159+
152160
@property
153161
def custom_id(self) -> str:
154162
""":class:`str`: The ID of the text input that gets received during an interaction."""

0 commit comments

Comments
 (0)