@@ -42,6 +42,16 @@ async def _msg_callback(ctx: prefixed.PrefixedContext, *args, **kwargs):
4242
4343
4444class HybridManager :
45+ """
46+ The main part of the extension. Deals with injecting itself in the first place.
47+
48+ Parameters:
49+ client: The client instance.
50+ hybrid_context: The object to instantiate for Hybrid Context
51+ use_slash_command_msg: If enabled, will send out a message encouraging users to use the slash command \
52+ equivalent whenever they use the prefixed command version.
53+ """
54+
4555 def __init__ (
4656 self , client : Client , * , hybrid_context : type [BaseContext ] = HybridContext , use_slash_command_msg : bool = False
4757 ) -> None :
@@ -54,13 +64,13 @@ def __init__(
5464 self .client = cast (prefixed .PrefixedInjectedClient , client )
5565 self .ext_command_list : dict [str , list [str ]] = {}
5666
57- self .client .add_listener (self .on_callback_added .copy_with_binding (self ))
67+ self .client .add_listener (self .add_hybrid_command .copy_with_binding (self ))
5868 self .client .add_listener (self .handle_ext_unload .copy_with_binding (self ))
5969
6070 self .client .hybrid = self
6171
62- @listen ()
63- async def on_callback_added (self , event : CallbackAdded ):
72+ @listen ("on_callback_added" )
73+ async def add_hybrid_command (self , event : CallbackAdded ):
6474 if not isinstance (event .callback , HybridSlashCommand ) or not event .callback .callback :
6575 return
6676
@@ -114,4 +124,19 @@ async def handle_ext_unload(self, event: ExtensionUnload) -> None:
114124def setup (
115125 client : Client , * , hybrid_context : type [BaseContext ] = HybridContext , use_slash_command_msg : bool = False
116126) -> HybridManager :
127+ """
128+ Sets up hybrid commands. It is recommended to use this function directly to do so.
129+
130+ !!! warning
131+ Prefixed commands need to be set up prior to using this.
132+
133+ Args:
134+ client: The client instance.
135+ hybrid_context: The object to instantiate for Hybrid Context
136+ use_slash_command_msg: If enabled, will send out a message encouraging users to use the slash command \
137+ equivalent whenever they use the prefixed command version.
138+
139+ Returns:
140+ HybridManager: The class that deals with all things hybrid commands.
141+ """
117142 return HybridManager (client , hybrid_context = hybrid_context , use_slash_command_msg = use_slash_command_msg )
0 commit comments