Skip to content

User and Message Application Commands #3614

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

Merged
merged 18 commits into from
Aug 10, 2021
Merged

Conversation

msciotti
Copy link
Contributor

@msciotti msciotti commented Aug 10, 2021

This is a pretty hefty docs overhaul to support new types of application commands: USER and MESSAGE.

TLDR: New context menu commands on users and messages are types of application commands. I've renamed the "Slash Commands" section to "Application Commands" and refactored the documentation section into:

  • Data models
  • General application command info
  • Slash command info
  • User command info
  • Message command info
  • Endpoints

Shoutouts to @ckohen for doing the work in splitting out interactions data from slash commands to begin with. Made this significantly easier ❤️

TODO:

  • Check for broken links
  • Check locally for styling
  • Add real date

@msciotti msciotti changed the title User and Message Application Commands [WIP] User and Message Application Commands Aug 10, 2021
Comment on lines -47 to -50
> info
> If your application only talks to Discord through creating Slash Commands and responding to Interactions, and does not use any other part of our API, **you no longer need to request the bot scope**.

Who knows, maybe in the future, Interactions tokens will become even smarter.
Copy link
Contributor

@A5rocks A5rocks Aug 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this idea scrapped? Or is it still on the table?

Because at the moment, interactions-only bots are severely underpowered (well, somewhat. They're good for just a request-reply command, but they miss some critical context that is needed otherwise).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not scrapped, no. This just felt a little sales-pitch-y from when slash commands were new, and I figured with more need to know stuff in the docs, it was OK to remove some fluff.

Comment on lines 261 to 263
| id | snowflake | the [`ID`](#DOCS_INTERACTIONS_APPLICATION_COMMANDS/application-command-object-application-command-structure) of the invoked command | Slash Command |
| name | string | the [`name`](#DOCS_INTERACTIONS_APPLICATION_COMMANDS/application-command-object-application-command-structure) of the invoked command | Slash Command |
| resolved? | [resolved data](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-resolved-data-structure) | converted users + roles + channels | Slash Command |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These apply to all Application Commands right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks!


Global commands are available on _all_ your app's guilds. Global commands are cached for **1 hour**. That means that new global commands will fan out slowly across all guilds, and will be guaranteed to be updated in an hour.

Global commands have inherent read-repair functionality. That means that if you make an update to a global command, and a user tries to use that command before it has updated for them, Discord will do an internal version check and reject the command, and trigger a faster reload for the guild in which it was used.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any details on how much "faster" this "faster reload" is?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me find out exactly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll get refreshed next time a client queries for commands, but there's a rate limit on it, so it's possible that a user could have a command rejected a couple times until a rate limit is lifted.

That's all behind the scenes semantics though. The TLDR is that if you update a command, you can be sure that you will receive interactions payloads that reflect the updated command.

"id": MODERATOR_ROLE_ID,
"type": 1,
"permission": True
###### Example Interaction
Copy link
Contributor

@A5rocks A5rocks Aug 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way to differentiate between slash cmds and context menu cmds is by keeping track of the command id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or their type.

1: Slash command
2: User command
3: Message command

@advaith1
Copy link
Contributor

need to add type to the creation endpoints

msciotti and others added 13 commits August 10, 2021 13:49
Co-authored-by: ckohen <chaikohen@gmail.com>
Co-authored-by: monbrey <rsm999@uowmail.edu.au>
Co-authored-by: monbrey <rsm999@uowmail.edu.au>
Co-authored-by: monbrey <rsm999@uowmail.edu.au>
Co-authored-by: Advaith <advaithj1@gmail.com>
@msciotti msciotti force-pushed the feature/context-menu-commands branch from e33a089 to b04a500 Compare August 10, 2021 20:50
@msciotti msciotti changed the title [WIP] User and Message Application Commands User and Message Application Commands Aug 10, 2021
@msciotti msciotti merged commit 80d2765 into master Aug 10, 2021
@msciotti msciotti deleted the feature/context-menu-commands branch August 10, 2021 21:17
Nihlus added a commit to Remora/Remora.Discord that referenced this pull request Aug 11, 2021
arqunis pushed a commit to serenity-rs/serenity that referenced this pull request Aug 20, 2021
This commit adds support to user and message context menus, which can be created with a new type of application command. Refer to discord/discord-api-docs#3614.
@kangalio
Copy link

Why was this very useful section removed?

Screenshot_20221113_150113

You can only get this full info from third party sites now

@kangalio
Copy link

(Someone in the serenity support server asked about subcommand limits and I remembered the above section but couldn't find it in the docs, so I searched around for like 20min to find that this PR yeeted the section)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants