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: application subscriptions #1113

Merged
merged 35 commits into from Jan 3, 2024
Merged

feat: application subscriptions #1113

merged 35 commits into from Jan 3, 2024

Conversation

shiftinv
Copy link
Member

@shiftinv shiftinv commented Sep 28, 2023

Summary

discord/discord-api-docs@b97fad3 (+ discord/discord-api-docs@b8feadd)

Since this feature is US-only, I'm unable to test most of it; still working on that part.
Nevertheless, all documented functionality is implemented. The SKU/Entitlement models have been tested using the example structs provided by the docs, but that's really it.
Tested all implemented functionality now.

There are a few TODOs scattered across the code regarding testing and naming some things; feedback for those would be appreciated. The api docs are lacking in a few aspects (gateway events, in particular, are somewhat of a guessing game), but most of it is fairly straightforward.

Checklist

  • If code changes were made, then they have been tested
    • I have updated the documentation to reflect the changes
    • I have formatted the code properly by running pdm lint
    • I have type-checked the code by running pdm pyright
  • This PR fixes an issue
  • This PR adds something new (e.g. new method or parameters)
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@shiftinv shiftinv added t: enhancement New feature t: api support Support of Discord API features s: needs review Issue/PR is awaiting reviews skip news and removed skip news labels Sep 28, 2023
@Skelmis
Copy link
Contributor

Skelmis commented Oct 23, 2023

Would you be able to provide/add an example to this pull request show casing how an end user would be able to utilize this functionality to mark a slash command as requiring premium? I can see it being quite a regular thing coming up in the future so the clarity would be nice

@shiftinv
Copy link
Member Author

Would you be able to provide/add an example to this pull request show casing how an end user would be able to utilize this functionality to mark a slash command as requiring premium? I can see it being quite a regular thing coming up in the future so the clarity would be nice

good point, thanks! Added in 989327a.
You don't preemptively mark certain commands as premium-only - it's a separate response type like e.g. .send_message or .defer. Ultimately it comes down to checking inter.entitlements and using response.require_premium() where needed.

@shiftinv shiftinv added this to the disnake v2.10 milestone Oct 26, 2023
@shiftinv
Copy link
Member Author

shiftinv commented Oct 29, 2023

Removed the SKU/entitlement HTTP endpoints in 4b66b52 due to https://github.com/discord/discord-api-docs/pull/6502/files#diff-39e6aeaafba5726f3fb409da21a6953dfb679480f09038a0d05f4dd93e89e074R11 :/
Hoping replacements will be available sooner rather than later, but I want to avoid changing this entire PR back to a draft; Interaction.entitlements is still the main app subscription interface. If the decision gets reverted, we can just reintroduce that commit again.

edit: reverted the revert again, as the linked changes were decided against.

@shiftinv shiftinv mentioned this pull request Dec 9, 2023
8 tasks
@Isabe1le
Copy link
Contributor

Isabe1le commented Jan 3, 2024

Please merge this 🙏🙏🙏

@shiftinv shiftinv removed the s: needs review Issue/PR is awaiting reviews label Jan 3, 2024
@shiftinv shiftinv merged commit 281b6ff into master Jan 3, 2024
27 checks passed
@shiftinv shiftinv deleted the feature/app-subscriptions branch January 3, 2024 18:21
@Isabe1le
Copy link
Contributor

Isabe1le commented Jan 3, 2024

🚀 LFG i’m a god

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t: api support Support of Discord API features t: enhancement New feature
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants