@@ -199,6 +199,7 @@ def __new__(cls: type[CogMeta], *args: Any, **kwargs: Any) -> CogMeta:
199
199
200
200
commands [f"ext_{ elem } " ] = value .ext_variant
201
201
commands [f"app_{ elem } " ] = value .slash_variant
202
+ commands [elem ] = value
202
203
for cmd in getattr (value , "subcommands" , []):
203
204
commands [
204
205
f"ext_{ cmd .ext_variant .qualified_name } "
@@ -229,9 +230,13 @@ def __new__(cls: type[CogMeta], *args: Any, **kwargs: Any) -> CogMeta:
229
230
230
231
# Either update the command with the cog provided defaults or copy it.
231
232
# r.e type ignore, type-checker complains about overriding a ClassVar
232
- new_cls .__cog_commands__ = tuple (c ._update_copy (cmd_attrs ) for c in new_cls .__cog_commands__ ) # type: ignore
233
+ new_cls .__cog_commands__ = tuple (c ._update_copy (cmd_attrs ) if not hasattr ( c , "add_to" ) else c for c in new_cls .__cog_commands__ ) # type: ignore
233
234
234
- name_filter = lambda c : "app" if isinstance (c , ApplicationCommand ) else "ext"
235
+ name_filter = (
236
+ lambda c : "app"
237
+ if isinstance (c , ApplicationCommand )
238
+ else ("bridge" if not hasattr (c , "add_to" ) else "ext" )
239
+ )
235
240
236
241
lookup = {
237
242
f"{ name_filter (cmd )} _{ cmd .qualified_name } " : cmd
@@ -247,7 +252,9 @@ def __new__(cls: type[CogMeta], *args: Any, **kwargs: Any) -> CogMeta:
247
252
):
248
253
command .guild_ids = new_cls .__cog_guild_ids__
249
254
250
- if not isinstance (command , SlashCommandGroup ):
255
+ if not isinstance (command , SlashCommandGroup ) and not hasattr (
256
+ command , "add_to"
257
+ ):
251
258
# ignore bridge commands
252
259
cmd = getattr (new_cls , command .callback .__name__ , None )
253
260
if hasattr (cmd , "add_to" ):
@@ -534,6 +541,10 @@ def _inject(self: CogT, bot) -> CogT:
534
541
# we've added so far for some form of atomic loading.
535
542
536
543
for index , command in enumerate (self .__cog_commands__ ):
544
+ if hasattr (command , "add_to" ):
545
+ bot ._bridge_commands .append (command )
546
+ continue
547
+
537
548
command ._set_cog (self )
538
549
539
550
if isinstance (command , ApplicationCommand ):
0 commit comments