@@ -296,7 +296,7 @@ async def to_dict(self):
296296 "options" : selected .options or [],
297297 "default_permission" : selected .default_permission ,
298298 "permissions" : {},
299- "type" : selected .type ,
299+ "type" : selected ._type ,
300300 }
301301 if y in selected .permissions :
302302 command_dict ["permissions" ][y ] = selected .permissions [y ]
@@ -679,7 +679,10 @@ def add_context_menu(self, cmd, name: str, _type: int, guild_ids: list = None):
679679 "has_subcommands" : False ,
680680 "api_permissions" : {},
681681 }
682- obj = model .BaseCommandObject (name , cmd = _cmd , type = _type )
682+
683+ print ("add_context_menu" .upper (), ": " , _cmd )
684+
685+ obj = model .BaseCommandObject (name , cmd = _cmd , _type = _type )
683686 self .commands ["context" ][name ] = obj
684687 self .logger .debug (f"Added context command `{ name } `" )
685688 return obj
@@ -1371,14 +1374,17 @@ async def on_socket_response(self, msg):
13711374 if msg ["t" ] != "INTERACTION_CREATE" :
13721375 return
13731376
1377+ print ("on_socket_response" .upper (), ": " , msg )
13741378 to_use = msg ["d" ]
13751379 interaction_type = to_use ["type" ]
1376- if interaction_type == 1 :
1377- return await self ._on_slash (to_use )
1378- if interaction_type in (2 , 3 ):
1379- return await self ._on_context_menu (to_use )
1380+ if interaction_type in (2 , 3 ) or msg ["s" ] == 5 :
1381+ await self ._on_slash (to_use )
1382+ await self ._on_context_menu (to_use )
1383+ if interaction_type >= 4 : # what the fuck did Discord make components!?
1384+ return await self ._on_component (to_use )
13801385
1381- raise NotImplementedError
1386+ return
1387+ # raise NotImplementedError
13821388
13831389 async def _on_component (self , to_use ):
13841390 ctx = context .ComponentContext (self .req , to_use , self ._discord , self .logger )
@@ -1439,11 +1445,11 @@ async def _on_slash(self, to_use):
14391445
14401446 async def _on_context_menu (self , to_use ):
14411447 if to_use ["data" ]["name" ] in self .commands ["context" ]:
1442- ctx = context .SlashContext (self .req , to_use , self ._discord , self .logger )
1448+ ctx = context .MenuContext (self .req , to_use , self ._discord , self .logger )
14431449 cmd_name = to_use ["data" ]["name" ]
14441450
14451451 if cmd_name not in self .commands ["context" ] and cmd_name in self .subcommands :
1446- return await self . handle_subcommand ( ctx , to_use )
1452+ return # menus don't have subcommands you smooth brain
14471453
14481454 selected_cmd = self .commands ["context" ][cmd_name ]
14491455
0 commit comments