28
28
Awaitable ,
29
29
Tuple ,
30
30
TypeVar ,
31
+ cast ,
31
32
overload ,
32
33
)
33
34
96
97
ComponentType ,
97
98
Intents ,
98
99
InteractionType ,
100
+ IntegrationType ,
99
101
Status ,
100
102
MessageFlags ,
101
103
)
@@ -296,6 +298,7 @@ def __init__(
296
298
component_context : Type [BaseContext ] = ComponentContext ,
297
299
context_menu_context : Type [BaseContext ] = ContextMenuContext ,
298
300
debug_scope : Absent ["Snowflake_Type" ] = MISSING ,
301
+ default_integration_types : Absent [list [IntegrationType ]] = MISSING ,
299
302
delete_unused_application_cmds : bool = False ,
300
303
disable_dm_commands : bool = False ,
301
304
enforce_interaction_perms : bool = True ,
@@ -356,6 +359,9 @@ def __init__(
356
359
self .auto_defer = auto_defer
357
360
"""A system to automatically defer commands after a set duration"""
358
361
self .intents = intents if isinstance (intents , Intents ) else Intents (intents )
362
+ self .default_integration_types = cast (list [IntegrationType ], default_integration_types ) or [
363
+ IntegrationType .GUILD_INSTALL
364
+ ]
359
365
360
366
# resources
361
367
if isinstance (proxy_auth , tuple ):
@@ -1364,7 +1370,7 @@ def add_listener(self, listener: Listener) -> None:
1364
1370
c_listener for c_listener in self .listeners [listener .event ] if not c_listener .is_default_listener
1365
1371
]
1366
1372
1367
- def add_interaction (self , command : InteractionCommand ) -> bool :
1373
+ def add_interaction (self , command : InteractionCommand ) -> bool : # noqa: C901
1368
1374
"""
1369
1375
Add a slash command to the client.
1370
1376
@@ -1378,6 +1384,9 @@ def add_interaction(self, command: InteractionCommand) -> bool:
1378
1384
if self .disable_dm_commands :
1379
1385
command .dm_permission = False
1380
1386
1387
+ if not command .integration_types :
1388
+ command .integration_types = list (self .default_integration_types )
1389
+
1381
1390
# for SlashCommand objs without callback (like objects made to hold group info etc)
1382
1391
if command .callback is None :
1383
1392
return False
0 commit comments