File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -95,9 +95,11 @@ def __init__(
9595 super ().__init__ (
9696 * args ,
9797 allowed_roles = allowed_roles ,
98+ tree_cls = CommandTreeBase ,
9899 ** kwargs ,
99100 )
100101
102+ self .command_error_manager : CommandErrorManager | None = None
101103 self .guild_id = guild_id
102104 self .http_session = http_session
103105 self .api_client = api_client
@@ -119,6 +121,16 @@ def __init__(
119121
120122 self .all_extensions : frozenset [str ] | None = None
121123
124+ def register_command_error_manager (self , manager : CommandErrorManager ) -> None :
125+ """
126+ Bind an instance of the command error manager to both the bot and the command tree.
127+
128+ The reason this doesn't happen in the constructor is because error handlers might need an instance of the bot.
129+ So registration needs to happen once the bot instance has been created.
130+ """
131+ self .command_error_manager = manager
132+ self .tree .command_error_manager = manager
133+
122134 def _connect_statsd (
123135 self ,
124136 statsd_url : str ,
You can’t perform that action at this time.
0 commit comments