I’m currently making a discord.js bot that gives users more features if they are subscribed to one of my patreon tiers, however the documentation has done nothing but cause me headaches so far. I have even found a few errors in the documentation that resulted in me diving into the library files to see how they work. Here’s my latest problem.
const { patreon, jsonApiURL } = require('patreon')
const pledge_schema = require('patreon/schemas/pledge')
const patreonAPIClient = patreon(access_token)
const url = jsonApiURL(`/current_user`, {
fields: {
pledge: [...pledge_schema.default_attributes, pledge_schema.attributes.total_historical_amount_cents]
}
})
patreonAPIClient(url, function(data) {
})
.catch(console.log)
I’m using the above code from the Patreon js library, filled in my creator access_token, fixed the pledge_schema = require(...
path (the documentation is incorrect), but I’m getting the following error:
pledge: [...pledge_schema.default_attributes,pledge_schema.attributes.total_historical_amount_cents]
^
TypeError: pledge_schema.default_attributes is not iterable
I’m currently using Glitch to experiment with the library in (relatively) real-time before I implement it into my project. Any help would be appreciated.