@@ -544,6 +544,7 @@ def get_guild_websocket(self, id: "Snowflake_Type") -> GatewayClient:
544
544
def _sanity_check (self ) -> None :
545
545
"""Checks for possible and common errors in the bot's configuration."""
546
546
self .logger .debug ("Running client sanity checks..." )
547
+
547
548
contexts = {
548
549
self .interaction_context : InteractionContext ,
549
550
self .component_context : ComponentContext ,
@@ -911,6 +912,11 @@ async def login(self, token: str | None = None) -> None:
911
912
# so im gathering commands here
912
913
self ._gather_callbacks ()
913
914
915
+ if any (v for v in constants .CLIENT_FEATURE_FLAGS .values ()):
916
+ # list all enabled flags
917
+ enabled_flags = [k for k , v in constants .CLIENT_FEATURE_FLAGS .items () if v ]
918
+ self .logger .info (f"Enabled feature flags: { ', ' .join (enabled_flags )} " )
919
+
914
920
self .logger .debug ("Attempting to login" )
915
921
me = await self .http .login (self .token )
916
922
self ._user = ClientUser .from_dict (me , self )
@@ -1105,7 +1111,7 @@ async def wait_for_component(
1105
1111
dict ,
1106
1112
]
1107
1113
] = None ,
1108
- check : Optional [Callable ] = None ,
1114
+ check : Absent [ Optional [Union [ Callable [..., bool ], Callable [..., Awaitable [ bool ]]]] ] = None ,
1109
1115
timeout : Optional [float ] = None ,
1110
1116
) -> "events.Component" :
1111
1117
"""
@@ -1136,22 +1142,26 @@ async def wait_for_component(
1136
1142
if custom_ids and not all (isinstance (x , str ) for x in custom_ids ):
1137
1143
custom_ids = [str (i ) for i in custom_ids ]
1138
1144
1139
- def _check (event : events .Component ) -> bool :
1145
+ async def _check (event : events .Component ) -> bool :
1140
1146
ctx : ComponentContext = event .ctx
1141
1147
# if custom_ids is empty or there is a match
1142
1148
wanted_message = not message_ids or ctx .message .id in (
1143
1149
[message_ids ] if isinstance (message_ids , int ) else message_ids
1144
1150
)
1145
1151
wanted_component = not custom_ids or ctx .custom_id in custom_ids
1146
1152
if wanted_message and wanted_component :
1153
+ if asyncio .iscoroutinefunction (check ):
1154
+ return bool (check is None or await check (event ))
1147
1155
return bool (check is None or check (event ))
1148
1156
return False
1149
1157
1150
1158
return await self .wait_for ("component" , checks = _check , timeout = timeout )
1151
1159
1152
1160
def command (self , * args , ** kwargs ) -> Callable :
1153
1161
"""A decorator that registers a command. Aliases `interactions.slash_command`"""
1154
- raise NotImplementedError # TODO: implement
1162
+ raise NotImplementedError (
1163
+ "Use interactions.slash_command instead. Please consult the v4 -> v5 migration guide https://interactions-py.github.io/interactions.py/Guides/98%20Migration%20from%204.X/"
1164
+ )
1155
1165
1156
1166
def listen (self , event_name : Absent [str ] = MISSING ) -> Callable [[AsyncCallable ], Listener ]:
1157
1167
"""
0 commit comments