mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 05:51:35 +02:00
Fix
This commit is contained in:
@@ -79,13 +79,14 @@ module.exports = class XiaoClient extends CommandoClient {
|
|||||||
|
|
||||||
async fetchPatrons() {
|
async fetchPatrons() {
|
||||||
if (!PATREON_ACCESS_TOKEN || !PATREON_CAMPAIGN_ID) return null;
|
if (!PATREON_ACCESS_TOKEN || !PATREON_CAMPAIGN_ID) return null;
|
||||||
const { body } = await request
|
const { text } = await request
|
||||||
.get(`https://www.patreon.com/api/oauth2/v2/campaigns/${PATREON_CAMPAIGN_ID}/members`)
|
.get(`https://www.patreon.com/api/oauth2/v2/campaigns/${PATREON_CAMPAIGN_ID}/members`)
|
||||||
.set({ Authorization: `Bearer ${PATREON_ACCESS_TOKEN}` })
|
.set({ Authorization: `Bearer ${PATREON_ACCESS_TOKEN}` })
|
||||||
.query({
|
.query({
|
||||||
include: 'currently_entitled_tiers,user',
|
include: 'currently_entitled_tiers,user',
|
||||||
'fields[user]': 'social_connections'
|
'fields[user]': 'social_connections'
|
||||||
});
|
});
|
||||||
|
const body = JSON.parse(text);
|
||||||
const patrons = [];
|
const patrons = [];
|
||||||
for (const patron of body.data) {
|
for (const patron of body.data) {
|
||||||
if (patron.attributes.patron_status !== 'active_patron') continue;
|
if (patron.attributes.patron_status !== 'active_patron') continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user