Skip to content

Commit 2cdbcc3

Browse files
committed
feat: Support IntegrationTypes Defaults Via AppInfo
1 parent 1e3567d commit 2cdbcc3

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

discord/bot.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,16 @@ def get_application_command(
411411
return
412412
return command
413413

414+
async def _get_command_defaults(self):
415+
app_info = await self._bot.application_info()
416+
integration_contexts = app_info.integration_types_config._to_payload().keys()
417+
418+
command_defaults = COMMAND_DEFAULTS.copy()
419+
command_defaults["integration_types"] = DefaultSetComparison(
420+
(MISSING, integration_contexts), lambda x, y: set(x) == set(y)
421+
)
422+
return command_defaults
423+
414424
async def get_desynced_commands(
415425
self,
416426
guild_id: int | None = None,
@@ -442,6 +452,8 @@ async def get_desynced_commands(
442452
the action, including ``id``.
443453
"""
444454

455+
updated_command_defaults = await self._get_command_defaults()
456+
445457
# We can suggest the user to upsert, edit, delete, or bulk upsert the commands
446458
def _check_command(cmd: ApplicationCommand, match: Mapping[str, Any]) -> bool:
447459
"""Returns True If Commands Are Equivalent"""
@@ -456,7 +468,9 @@ def _check_command(cmd: ApplicationCommand, match: Mapping[str, Any]) -> bool:
456468
return _check_command(subcommand, match_)
457469
else:
458470
if cmd.parent is None:
459-
return _compare_defaults(cmd.to_dict(), match, COMMAND_DEFAULTS)
471+
return _compare_defaults(
472+
cmd.to_dict(), match, updated_command_defaults
473+
)
460474
else:
461475
return _compare_defaults(cmd.to_dict(), match, SUBCOMMAND_DEFAULTS)
462476

0 commit comments

Comments
 (0)