@@ -245,30 +245,30 @@ def handle_dispatch(self, event: str, data: dict) -> None:
245245 :type data: dict
246246 """
247247
248- def check_sub_command (self , option ) -> dict :
248+ def check_sub_command (option ) -> dict :
249249 _kwargs = dict ()
250- if "options" in option :
250+ if option . _json . get ( "options" ) :
251251 if option ["type" ] == OptionType .SUB_COMMAND_GROUP :
252252 _kwargs ["sub_command_group" ] = option ["name" ]
253253 for group_option in option ["options" ]:
254254 _kwargs ["sub_command" ] = group_option ["name" ]
255- if "options" in group_option :
255+ if group_option . get ( "options" ) :
256256 for sub_option in group_option ["options" ]:
257257 _kwargs [sub_option ["name" ]] = sub_option ["value" ]
258258 elif option ["type" ] == OptionType .SUB_COMMAND :
259259 _kwargs ["sub_command" ] = option ["name" ]
260260 for sub_option in option ["options" ]:
261261 _kwargs [sub_option ["name" ]] = sub_option ["value" ]
262262 else :
263- _kwargs [option [ " name" ]] = option [ " value" ]
263+ _kwargs [option . name ] = option . value
264264
265265 return _kwargs
266266
267- def check_sub_auto (self , option ) -> tuple :
268- if "options" in option :
267+ def check_sub_auto (option ) -> tuple :
268+ if option . _json . get ( "options" ) :
269269 if option ["type" ] == OptionType .SUB_COMMAND_GROUP :
270270 for group_option in option ["options" ]:
271- if "options" in group_option :
271+ if group_option . get ( "options" ) :
272272 for sub_option in option ["options" ]:
273273 if sub_option .get ("focused" ):
274274 return sub_option ["name" ], sub_option ["value" ]
@@ -310,15 +310,15 @@ def check_sub_auto(self, option) -> tuple:
310310 _kwargs : dict = dict ()
311311 if data ["type" ] == InteractionType .APPLICATION_COMMAND :
312312 _name = context .data .name
313- if hasattr ( context .data , "options" ):
313+ if context .data . _json . get ( "options" ):
314314 if context .data .options :
315315 for option in context .data .options :
316316 _kwargs .update (check_sub_command (option ))
317317 elif data ["type" ] == InteractionType .MESSAGE_COMPONENT :
318318 _name = context .data .custom_id
319319 elif data ["type" ] == InteractionType .APPLICATION_COMMAND_AUTOCOMPLETE :
320320 _name = "autocomplete_"
321- if hasattr ( context .data , "options" ):
321+ if context .data . _json . get ( "options" ):
322322 if context .data .options :
323323 for option in context .data .options :
324324 add_name , add_args = check_sub_auto (option )
0 commit comments