@@ -360,7 +360,7 @@ def is_components_v2(self) -> bool:
360
360
async def _scheduled_task (self , item : Item [V ], interaction : Interaction ):
361
361
try :
362
362
if self .timeout :
363
- self .__timeout_expiry = time .monotonic () + self .timeout
363
+ self ._timeout_expiry = time .monotonic () + self .timeout
364
364
365
365
allow = await self .interaction_check (interaction )
366
366
if not allow :
@@ -371,26 +371,26 @@ async def _scheduled_task(self, item: Item[V], interaction: Interaction):
371
371
return await self .on_error (e , item , interaction )
372
372
373
373
def _start_listening_from_store (self , store : ViewStore ) -> None :
374
- self .__cancel_callback = partial (store .remove_view )
374
+ self ._cancel_callback = partial (store .remove_view )
375
375
if self .timeout :
376
376
loop = asyncio .get_running_loop ()
377
- if self .__timeout_task is not None :
378
- self .__timeout_task .cancel ()
377
+ if self ._timeout_task is not None :
378
+ self ._timeout_task .cancel ()
379
379
380
- self .__timeout_expiry = time .monotonic () + self .timeout
381
- self .__timeout_task = loop .create_task (self .__timeout_task_impl ())
380
+ self ._timeout_expiry = time .monotonic () + self .timeout
381
+ self ._timeout_task = loop .create_task (self ._timeout_task_impl ())
382
382
383
383
def _dispatch_timeout (self ):
384
- if self .__stopped .done ():
384
+ if self ._stopped .done ():
385
385
return
386
386
387
- self .__stopped .set_result (True )
387
+ self ._stopped .set_result (True )
388
388
asyncio .create_task (
389
389
self .on_timeout (), name = f"discord-ui-view-timeout-{ self .id } "
390
390
)
391
391
392
392
def _dispatch_item (self , item : Item [V ], interaction : Interaction ):
393
- if self .__stopped .done ():
393
+ if self ._stopped .done ():
394
394
return
395
395
396
396
if interaction .message :
@@ -403,14 +403,14 @@ def _dispatch_item(self, item: Item[V], interaction: Interaction):
403
403
404
404
def is_finished (self ) -> bool :
405
405
"""Whether the view has finished interacting."""
406
- return self .__stopped .done ()
406
+ return self ._stopped .done ()
407
407
408
408
def is_dispatchable (self ) -> bool :
409
409
return any (item .is_dispatchable () for item in self .children )
410
410
411
411
def is_dispatching (self ) -> bool :
412
412
"""Whether the view has been added for dispatching purposes."""
413
- return self .__cancel_callback is not None
413
+ return self ._cancel_callback is not None
414
414
415
415
def is_persistent (self ) -> bool :
416
416
"""Whether the view is set up as persistent.
@@ -427,17 +427,17 @@ def stop(self) -> None:
427
427
428
428
This operation cannot be undone.
429
429
"""
430
- if not self .__stopped .done ():
431
- self .__stopped .set_result (False )
430
+ if not self ._stopped .done ():
431
+ self ._stopped .set_result (False )
432
432
433
- self .__timeout_expiry = None
434
- if self .__timeout_task is not None :
435
- self .__timeout_task .cancel ()
436
- self .__timeout_task = None
433
+ self ._timeout_expiry = None
434
+ if self ._timeout_task is not None :
435
+ self ._timeout_task .cancel ()
436
+ self ._timeout_task = None
437
437
438
- if self .__cancel_callback :
439
- self .__cancel_callback (self )
440
- self .__cancel_callback = None
438
+ if self ._cancel_callback :
439
+ self ._cancel_callback (self )
440
+ self ._cancel_callback = None
441
441
442
442
async def wait (self ) -> bool :
443
443
"""Waits until the view has finished interacting.
@@ -451,7 +451,7 @@ async def wait(self) -> bool:
451
451
If ``True``, then the view timed out. If ``False`` then
452
452
the view finished normally.
453
453
"""
454
- return await self .__stopped
454
+ return await self ._stopped
455
455
456
456
def disable_all_items (self , * , exclusions : list [Item [V ]] | None = None ) -> Self :
457
457
"""
0 commit comments