101101 ModalContext ,
102102 ComponentContext ,
103103 AutocompleteContext ,
104+ ContextMenuContext ,
104105)
105106from interactions .models .internal .listener import Listener
106107from interactions .models .internal .tasks import Task
@@ -257,7 +258,9 @@ def __init__(
257258 activity : Union [Activity , str ] = None ,
258259 auto_defer : Absent [Union [AutoDefer , bool ]] = MISSING ,
259260 autocomplete_context : Type [BaseContext ] = AutocompleteContext ,
261+ basic_logging : bool = False ,
260262 component_context : Type [BaseContext ] = ComponentContext ,
263+ context_menu_context : Type [BaseContext ] = ContextMenuContext ,
261264 debug_scope : Absent ["Snowflake_Type" ] = MISSING ,
262265 delete_unused_application_cmds : bool = False ,
263266 disable_dm_commands : bool = False ,
@@ -268,19 +271,18 @@ def __init__(
268271 intents : Union [int , Intents ] = Intents .DEFAULT ,
269272 interaction_context : Type [InteractionContext ] = InteractionContext ,
270273 logger : logging .Logger = MISSING ,
271- owner_ids : Iterable [ "Snowflake_Type" ] = () ,
274+ logging_level : int = logging . INFO ,
272275 modal_context : Type [BaseContext ] = ModalContext ,
276+ owner_ids : Iterable ["Snowflake_Type" ] = (),
273277 send_command_tracebacks : bool = True ,
274278 shard_id : int = 0 ,
275279 show_ratelimit_tracebacks : bool = False ,
276280 slash_context : Type [BaseContext ] = SlashContext ,
277281 status : Status = Status .ONLINE ,
282+ sync_ext : bool = True ,
278283 sync_interactions : bool = True ,
279284 token : str | None = None ,
280- sync_ext : bool = True ,
281285 total_shards : int = 1 ,
282- basic_logging : bool = False ,
283- logging_level : int = logging .INFO ,
284286 ** kwargs ,
285287 ) -> None :
286288 if logger is MISSING :
@@ -332,6 +334,8 @@ def __init__(
332334 """The object to instantiate for Modal Context"""
333335 self .slash_context : Type [BaseContext ] = slash_context
334336 """The object to instantiate for Slash Context"""
337+ self .context_menu_context : Type [BaseContext ] = context_menu_context
338+ """The object to instantiate for Context Menu Context"""
335339
336340 self .token : str | None = token
337341
@@ -1553,7 +1557,10 @@ async def get_context(self, data: dict) -> InteractionContext:
15531557 case InteractionType .MODAL_RESPONSE :
15541558 cls = self .modal_context .from_dict (self , data )
15551559 case InteractionType .APPLICATION_COMMAND :
1556- cls = self .slash_context .from_dict (self , data )
1560+ if data ["data" ].get ("target_id" ):
1561+ cls = self .context_menu_context .from_dict (self , data )
1562+ else :
1563+ cls = self .slash_context .from_dict (self , data )
15571564 case _:
15581565 self .logger .warning (f"Unknown interaction type [{ data ['type' ]} ] - please update or report this." )
15591566 cls = self .interaction_context .from_dict (self , data )
0 commit comments