Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit 4c78ee7

Browse files
committed
fixed wait_for
1 parent 8001f3a commit 4c78ee7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

discord_ui/receive.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,6 @@ def __init__(self, *, state, channel, data):
372372
:type: List[]:class:`~Button` | :class:`~LinkButton` | :class:`SelectMenu`]
373373
"""
374374
self.suppressed = False
375-
376375
self._update_components(data)
377376

378377
# region attributes
@@ -528,7 +527,7 @@ def action_rows(self):
528527
rows.append(c_row)
529528
return rows
530529

531-
async def wait_for(self, event_name: typing.Literal["select", "button"], client, custom_id=MISSING, by=None, check=lambda component: True, timeout=None) -> typing.Union[PressedButton, SelectedMenu]:
530+
async def wait_for(self, event_name: typing.Literal["select", "button"], client, custom_id=MISSING, by=MISSING, check=lambda component: True, timeout=None) -> typing.Union[PressedButton, SelectedMenu]:
532531
"""Waits for a message component to be invoked in this message
533532
534533
Parameters
@@ -566,11 +565,11 @@ async def wait_for(self, event_name: typing.Literal["select", "button"], client,
566565
def _check(com):
567566
if com.message.id == self.id:
568567
statements = []
569-
if custom_id is not MISSING:
568+
if custom_id not in [MISSING, None]:
570569
statements.append(com.custom_id == custom_id)
571-
if by is not MISSING:
570+
if by not in [MISSING, None]:
572571
statements.append(com.member.id == (by.id if hasattr(by, "id") else int(by)))
573-
if check is not MISSING:
572+
if check not in [MISSING, None]:
574573
statements.append(check(com))
575574
return all(statements)
576575
return False

0 commit comments

Comments
 (0)