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

feat(Interaction): add isApplicationCommand check #6801

Merged
merged 4 commits into from Oct 12, 2021
Merged

feat(Interaction): add isApplicationCommand check #6801

merged 4 commits into from Oct 12, 2021

Conversation

manuelvleeuwen
Copy link
Contributor

@manuelvleeuwen manuelvleeuwen commented Oct 9, 2021

Please describe the changes this PR makes and why it should be merged:
Introduces Interaction#isApplicationCommand, which indicates whether or not the interaction is a BaseCommandInteraction (as of now the only subclasses are CommandInteraction or ContextMenuInteraction, but there might come more in the future).

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (methods or parameters added)

@iCrawl
Copy link
Member

iCrawl commented Oct 9, 2021

This is a semver-major and seems too big of a change, considering we don't even know when we'll release the next major and what has changed on Discords side to maybe justify this.

@manuelvleeuwen
Copy link
Contributor Author

Yeah, I agree that renaming might be too big of a change, but still a check like Interaction#isApplicationCommand would be useful, for example: I defer all application command interactions by default (I'm making API calls that delay for quite long) and I can run them without checking whether they are slash commands or context menus.

interaction.isCommand() || interaction.isContextMenu()

also works but imo a single check for this is cleaner.

@ImRodry
Copy link
Contributor

ImRodry commented Oct 9, 2021

You can add the isApplicationCommand method just fine without needing to rename the class

@manuelvleeuwen manuelvleeuwen changed the title refactor: rename BaseCommandInteraction to ApplicationCommandInteraction feat(Interaction): add isApplicationCommand check Oct 9, 2021
@iCrawl iCrawl merged commit 6898fa3 into discordjs:main Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants