Skip to content

bug: command always updates when setIntegrationTypes or setContexts arrays are unsorted #865

Description

@AngelCMHxD

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

Whenever you register a command and use either setIntegrationTypes or setContexts. If you put the enums in an unsorted non-ascending order (ex. 2,1,0; 0,2,1; 2,0,1; etc). The command is always detected as different and is updated, even when the actual integration types or contexts didn't change, increasing load times by a lot.

Steps To Reproduce

  1. In any command, set integration types or contexts values in an unsorted order. Ex:
builder.setIntegrationTypes([
	ApplicationIntegrationType.UserInstall, // = 1
	ApplicationIntegrationType.GuildInstall, // = 0
]);
  1. Set the command's behaviorWhenNotIdentical to RegisterBehavior.VerboseOverwrite
  2. Set client's logger level to LogLevel.Debug

Each time the command is loaded, it'll say that it found differences and updates the command, even if you don't change the actual integration types.

Expected behavior

The command shouldn't be updated because there weren't any actual differences.

Screenshots

With non-sorted values:
Image

Once the values are sorted:
Image

Additional context

No response

System Info

System:
    OS: Linux 6.19 Arch Linux
    CPU: (16) x64 AMD Ryzen 7 7730U with Radeon Graphics
    Memory: 2.80 GB / 15.02 GB
    Container: Yes
    Shell: 4.6.0 - /usr/bin/fish
  Binaries:
    Node: 25.9.0 - /usr/bin/node
    npm: 11.12.1 - /usr/bin/npm
    pnpm: 10.33.0 - /usr/bin/pnpm
    bun: 1.3.11 - /home/angel/.bun/bin/bun
  Browsers:
    Chromium: 146.0.7680.177

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions