-
-
Notifications
You must be signed in to change notification settings - Fork 4k
feat: add subscriptions #10541
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: add subscriptions #10541
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
OfficialSirH
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me parece bien
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the documentation1 and the specification2, ends_at may now be null. This means this logic needs to be modified as Date.parse(null) will result in NaN:
discord.js/packages/discord.js/src/structures/Entitlement.js
Lines 84 to 93 in f2f7f1f
| if ('ends_at' in data) { | |
| /** | |
| * The timestamp at which this entitlement is no longer valid | |
| * <info>This is only `null` for test entitlements</info> | |
| * @type {?number} | |
| */ | |
| this.endsTimestamp = Date.parse(data.ends_at); | |
| } else { | |
| this.endsTimestamp ??= null; | |
| } |
I say this, but the entitlement object itself on the documentation does not have it marked as nullable. It probably needs updating (discord/discord-api-docs#7268).
Footnotes
packages/discord.js/src/client/websocket/handlers/SUBSCRIPTION_DELETE.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Jiralite <[email protected]>
This reverts commit ba472bd.
* feat: add subscriptions * types: fix fetch options types * fix: correct properties in patch method * chore: requested changes Co-authored-by: Jiralite <[email protected]> * fix: correct export syntax * chore(Entitlement): mark `ends_at` as nullable` * types(FetchSubscriptionOptions): add missing `cache` option * Revert "types(FetchSubscriptionOptions): add missing `cache` option" This reverts commit ba472bd. * chore(Entitlement): mark `startsTimestamp` as nullable * fix: requested changes * docs(SubscriptionManager): correct return type --------- Co-authored-by: Jiralite <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Please describe the changes this PR makes and why it should be merged:
Adds subscriptions for mainlib
Status and versioning classification: