@@ -560,9 +560,12 @@ def _sanity_check(self) -> None:
560560 def _queue_task (self , coro : Listener , event : BaseEvent , * args , ** kwargs ) -> asyncio .Task :
561561 async def _async_wrap (_coro : Listener , _event : BaseEvent , * _args , ** _kwargs ) -> None :
562562 try :
563- if not isinstance (_event , (events .Error , events .RawGatewayEvent )):
564- if coro .delay_until_ready and not self .is_ready :
565- await self .wait_until_ready ()
563+ if (
564+ not isinstance (_event , (events .Error , events .RawGatewayEvent ))
565+ and coro .delay_until_ready
566+ and not self .is_ready
567+ ):
568+ await self .wait_until_ready ()
566569
567570 if len (_event .__attrs_attrs__ ) == 2 and coro .event != "event" :
568571 # override_name & bot & logging
@@ -1046,11 +1049,7 @@ async def wait_for_modal(
10461049 def predicate (event ) -> bool :
10471050 if modal .custom_id != event .ctx .custom_id :
10481051 return False
1049- if not author :
1050- return True
1051- if author != to_snowflake (event .ctx .author ):
1052- return False
1053- return True
1052+ return author == to_snowflake (event .ctx .author ) if author else True
10541053
10551054 resp = await self .wait_for ("modal_completion" , predicate , timeout )
10561055 return resp .ctx
@@ -1085,7 +1084,7 @@ async def wait_for_component(
10851084 asyncio.TimeoutError: if timed out
10861085
10871086 """
1088- if not ( messages or components ) :
1087+ if not messages and not components :
10891088 raise ValueError ("You must specify messages or components (or both)" )
10901089
10911090 message_ids = (
@@ -1105,9 +1104,7 @@ def _check(event: events.Component) -> bool:
11051104 )
11061105 wanted_component = not custom_ids or ctx .custom_id in custom_ids
11071106 if wanted_message and wanted_component :
1108- if check is None or check (event ):
1109- return True
1110- return False
1107+ return bool (check is None or check (event ))
11111108 return False
11121109
11131110 return await self .wait_for ("component" , checks = _check , timeout = timeout )
@@ -1242,7 +1239,7 @@ def add_interaction(self, command: InteractionCommand) -> bool:
12421239
12431240 if group is None or isinstance (command , ContextMenu ):
12441241 self .interaction_tree [scope ][command .resolved_name ] = command
1245- elif group is not None :
1242+ else :
12461243 if not (current := self .interaction_tree [scope ].get (base )) or isinstance (current , SlashCommand ):
12471244 self .interaction_tree [scope ][base ] = {}
12481245 if sub is None :
@@ -1754,9 +1751,7 @@ def get_ext(self, name: str) -> Extension | None:
17541751 Returns:
17551752 A extension, if found
17561753 """
1757- if ext := self .get_extensions (name ):
1758- return ext [0 ]
1759- return None
1754+ return ext [0 ] if (ext := self .get_extensions (name )) else None
17601755
17611756 def __load_module (self , module , module_name , ** load_kwargs ) -> None :
17621757 """Internal method that handles loading a module."""
0 commit comments