Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integration_types and contexts are both documented as non-nullable with defaults, but contexts can be null #6744

Closed
AtoraSuunva opened this issue Mar 21, 2024 · 0 comments · Fixed by #6765
Labels
bug synced Synced to internal tracker

Comments

@AtoraSuunva
Copy link

AtoraSuunva commented Mar 21, 2024

Description

Under Application Command Structure, both the new integration_types and contexts fields are documented as non-nullable and with defaults.

If you create an application command that doesn't specify:

  • integration_types: it will be [0] (as the documentation says: "Defaults to GUILD_INSTALL (0)")
  • contexts: it will be null (despite not being marked nullable and supposedly "By default, all interaction context types included for new commands.")

Is contexts supposed to behave like integration_types and return the default instead of null? Is it expected to return null?

Edit: Seems like contexts also isn't including all interaction context types by default. Any application command with "contexts": null won't be visible/usable in DMs/Group DMs, only in guilds or DMs with the bot.

Steps to Reproduce

PUT a simple command for your app that doesn't specify integration_types or contexts:

curl -H "Authorization: Bot {token}" -X PUT -H 'Content-Type: application/json' -d '[{"name":"foo", "type": 2}]' https://discord.com/api/v10/applications/{application.id}/commands

And the response will include defaults for integration_types but null for contexts:

[
  {
    "id": "{id}",
    "application_id": "{id}",
    "version": "{id}",
    "default_member_permissions": null,
    "type": 2,
    "name": "foo",
    "description": "",
    "dm_permission": true,
    "contexts": null,
    "integration_types": [
      0
    ],
    "nsfw": false
  }
]

Expected Behavior

Either:

  • contexts is documented as nullable
  • or contexts is given a default value like integration_types is

Current Behavior

contexts is documented non-nullable, but the API can return null

Screenshots/Videos

image

Client and System Information

curl 7.81.0

@Rodentman87 Rodentman87 added the synced Synced to internal tracker label Mar 21, 2024
freya022 added a commit to freya022/JDA that referenced this issue Mar 26, 2024
Discord says it's not null, but it is in guild commands
See discord/discord-api-docs#6744
freya022 added a commit to freya022/JDA that referenced this issue Mar 26, 2024
Discord says it's not null, but it is in guild commands
See discord/discord-api-docs#6744
freya022 added a commit to freya022/JDA that referenced this issue Apr 11, 2024
Discord says it's not null, but it is in guild commands
See discord/discord-api-docs#6744
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug synced Synced to internal tracker
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants