You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the Application Command Structure reference, the default installation context is based on the application's "configured contexts", presumably meaning the contexts configured in the "Installation" tab on the application's page:
integration_types?
Installation contexts where the command is available, only for globally-scoped commands.
Defaults to your app's configured contexts
And the default for interaction contexts is all contexts:
contexts?
Interaction context(s) where the command can be used, only for globally-scoped commands.
By default, all interaction context types included for new commands.
By default, contexts includes all interaction context types.
However, when testing this with "integration_types": null and "contexts": null on a newly created command, it appears that the default contexts do not include the USER_INSTALL context or the PRIVATE_CHANNEL interaction context.
Steps to Reproduce
I have tested this using discord.py 2.4.0. Payloads described here are as reported by the library. Notably, discord.py does not support excluding the contexts and integration_types keys, only nullifying them. I have not tested whether the behaviour changes with omitted keys.
Set the application's supported installation contexts to Guild Install and User Install.
Authorize the application with a User Install.
Define a command without any contexts set:
importjsonimportdiscordfromdiscordimportapp_commandsfromdiscord.extimportcommandsbot=commands.Bot(command_prefix=commands.when_mentioned, intents=discord.Intents.default())
@bot.tree.command()# @app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)# @app_commands.allowed_installs(guilds=True, users=True)asyncdefgreet(interaction: discord.Interaction, user: discord.User):
"""Ask me to greet someone!"""awaitinteraction.response.send_message(f"Hello, {user.mention}!")
print(json.dumps(greet.to_dict(bot.tree), indent=4))
In steps 4, 7, 8, and 9, I would expect the command to be usable in all interaction contexts, since both Guild and User installation contexts were enabled in the Developer Portal and according to the documentation, the default installation and interaction contexts would all be allowed by default.
Current Behavior
In step 4 (default installation and interaction contexts), the command could not be accessed anywhere unless I shared a guild with the bot, then it was allowed for that guild and the bot's DMs.
In step 7 (defined interaction contexts only), it was the same as above.
In step 8 (defined installation contexts only), the command could be used in any guild and the bot's DMs (including with no mutual guilds), but the command was not available in other DM channels.
In step 9 (defined installation and interaction contexts), the command could be used in all guilds and DM channels.
Description
According to the Application Command Structure reference, the default installation context is based on the application's "configured contexts", presumably meaning the contexts configured in the "Installation" tab on the application's page:
And the default for interaction contexts is all contexts:
Which is also reflected in the Interaction Contexts section:
However, when testing this with
"integration_types": null
and"contexts": null
on a newly created command, it appears that the default contexts do not include theUSER_INSTALL
context or thePRIVATE_CHANNEL
interaction context.Steps to Reproduce
I have tested this using
discord.py 2.4.0
. Payloads described here are as reported by the library. Notably, discord.py does not support excluding thecontexts
andintegration_types
keys, only nullifying them. I have not tested whether the behaviour changes with omitted keys.Set the application's supported installation contexts to Guild Install and User Install.
Authorize the application with a User Install.
Define a command without any contexts set:
Create the command on Discord (in discord.py's case, using Bulk Overwrite Global Commands via
bot.tree.sync()
):Reload the client (Ctrl+R).
Check where the command can be used:
Uncomment just the
@allowed_contexts()
decorator and repeat steps 4-6.Comment the
@allowed_contexts()
and uncomment just the@allowed_installs()
decorator, then repeat steps 4-6.Uncomment both decorators and repeat steps 4-6.
The command payloads printed in steps 4, 7, 8, and 9 are as follows:
No contexts explicitly defined
Defined interaction contexts
Defined installation contexts
Defined installation and interaction contexts
Expected Behavior
In steps 4, 7, 8, and 9, I would expect the command to be usable in all interaction contexts, since both Guild and User installation contexts were enabled in the Developer Portal and according to the documentation, the default installation and interaction contexts would all be allowed by default.
Current Behavior
In step 4 (default installation and interaction contexts), the command could not be accessed anywhere unless I shared a guild with the bot, then it was allowed for that guild and the bot's DMs.
In step 7 (defined interaction contexts only), it was the same as above.
In step 8 (defined installation contexts only), the command could be used in any guild and the bot's DMs (including with no mutual guilds), but the command was not available in other DM channels.
In step 9 (defined installation and interaction contexts), the command could be used in all guilds and DM channels.
Screenshots/Videos
No response
Client and System Information
Client:
canary 322306 (15152ef) Host 1.0.437 x64 (51549) Build Override: N/A Windows 11 64-bit (10.0.22631)
Library:
discord.py 2.4.0
The text was updated successfully, but these errors were encountered: