-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
base: main
Are you sure you want to change the base?
feat: add subscriptions #10541
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
2401984
to
1d66e02
Compare
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
83fa2bf
to
cc694a9
Compare
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
cc694a9
to
5468dee
Compare
5468dee
to
ba472bd
Compare
14b9f7b
to
13e69ca
Compare
Co-authored-by: Jiralite <[email protected]>
This reverts commit ba472bd.
13e69ca
to
080e537
Compare
const Events = require('../../../util/Events'); | ||
|
||
module.exports = (client, { d: data }) => { | ||
const subscription = client.application.subscriptions.cache._add(data, false); |
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.
const subscription = client.application.subscriptions.cache._add(data, false); | |
const subscription = client.application.subscriptions._add(data, false); |
this.currentPeriodStart = new Date(data.current_period_start); | ||
|
||
/** | ||
* The end of the current subscription period | ||
* @type {Date} | ||
*/ | ||
this.currentPeriodEnd = new Date(data.current_period_end); |
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.
Shouldn't this follow the same structure as the other timestamp fields?
Please describe the changes this PR makes and why it should be merged:
Adds subscriptions for mainlib
Status and versioning classification: