@@ -15,6 +15,8 @@ class SlashCommand:
15
15
:type client: Union[discord.Client, discord.ext.commands.Bot]
16
16
:param auto_register: Whether to register commands automatically. Default `False`. Currently not implemented.
17
17
:type auto_register: bool
18
+ :param override_type: Whether to override checking type of the client and try register event.
19
+ :type override_type: bool
18
20
19
21
:ivar _discord: Discord client of this client.
20
22
:ivar commands: Dictionary of the registered commands via :func:`.slash` decorator.
@@ -24,7 +26,8 @@ class SlashCommand:
24
26
"""
25
27
def __init__ (self ,
26
28
client : typing .Union [discord .Client , commands .Bot ],
27
- auto_register : bool = False ):
29
+ auto_register : bool = False ,
30
+ override_type : bool = False ):
28
31
self ._discord = client
29
32
self .commands = {}
30
33
self .subcommands = {}
@@ -33,7 +36,7 @@ def __init__(self,
33
36
self .auto_register = auto_register
34
37
if self .auto_register :
35
38
self .logger .warning ("auto_register is NOT implemented! Please manually add commands to Discord API." )
36
- if not isinstance (client , commands .Bot ):
39
+ if not isinstance (client , commands .Bot ) and not override_type :
37
40
self .logger .info ("Detected discord.Client! Overriding on_socket_response." )
38
41
self ._discord .on_socket_response = self .on_socket_response
39
42
else :
0 commit comments