Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 38 additions & 2 deletions src/managers/BillingManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,45 @@
async fetchCurrentSubscription() {
// https://discord.com/api/v9/users/@me/billing/subscriptions
const d = await this.client.api.users('@me').billing.subscriptions.get();
this.currentSubscription = new Collection(d.map(s => [s.id, s]));

Check failure on line 61 in src/managers/BillingManager.js

View workflow job for this annotation

GitHub Actions / ESLint

Trailing spaces not allowed

Check failure on line 61 in src/managers/BillingManager.js

View workflow job for this annotation

GitHub Actions / ESLint

Delete `··`
const currentSubscription = d.map(subscription => {

Check failure on line 62 in src/managers/BillingManager.js

View workflow job for this annotation

GitHub Actions / ESLint

Unexpected block statement surrounding arrow body; parenthesize the returned value and move it immediately after the `=>`
return {
...subscription,
/**
* Cancels the subscription
* @returns {Promise<void>}
*/
cancel: async () => {

Check failure on line 69 in src/managers/BillingManager.js

View workflow job for this annotation

GitHub Actions / ESLint

Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`
// https://discord.com/api/v9/users/@me/billing/subscriptions/{subscription.id}?location_stack=user%20settings&location_stack=subscription%20header&location_stack=premium%20subscription%20cancellation%20modal
return void await this.client.api.users('@me').billing.subscriptions(subscription.id).patch({

Check failure on line 71 in src/managers/BillingManager.js

View workflow job for this annotation

GitHub Actions / ESLint

Replace `await·this.client.api.users('@me').billing.subscriptions(subscription.id)` with `(await·this.client.api⏎············.users('@me')⏎············.billing.subscriptions(subscription.id)⏎············`

Check failure on line 71 in src/managers/BillingManager.js

View workflow job for this annotation

GitHub Actions / ESLint

Expected 'undefined' and instead saw 'void'
data: {

Check failure on line 72 in src/managers/BillingManager.js

View workflow job for this annotation

GitHub Actions / ESLint

Insert `··`
payment_source_token: null,

Check failure on line 73 in src/managers/BillingManager.js

View workflow job for this annotation

GitHub Actions / ESLint

Replace `··············` with `················`
gateway_checkout_context: null,

Check failure on line 74 in src/managers/BillingManager.js

View workflow job for this annotation

GitHub Actions / ESLint

Insert `··`
expected_invoice_price: {

Check failure on line 75 in src/managers/BillingManager.js

View workflow job for this annotation

GitHub Actions / ESLint

Insert `··`
amount: 0,
currency: subscription.currency
},
expected_renewal_price: {
amount: 0,
currency: subscription.currency
},
items: []
},
query: {
location_stack: [
"user settings",
"subscription header",
"premium subscription cancellation modal"
]
}
});
}
};
});

this.currentSubscription = new Collection(currentSubscription.map(s => [s.id, s]));
return this.currentSubscription;
}
}

module.exports = BillingManager;
module.exports = BillingManager;