I am making a discord bot in Python. How can I make a script that gets all the pledges and their discord ids to check if they have pledged to our Patreon thing? I want to get these values in python btw.
Thanks In Advance!
I am making a discord bot in Python. How can I make a script that gets all the pledges and their discord ids to check if they have pledged to our Patreon thing? I want to get these values in python btw.
Thanks In Advance!
This is a broad question, there are various ways to do it.
https://docs.patreon.com/#get-api-oauth2-v2-campaigns-campaign_id-members
Getting all the members for your campaign, and then getting each member’s details is an option.
So in the api The Response GIves you this
{
"data": {
"attributes": {
"about": null,
"created": "2017-10-20T21:36:23+00:00",
**"discord_id"**: null,
"email": "corgi@example.com",
"facebook": null,
"facebook_id": null,
"first_name": "Corgi",
"full_name": "Corgi The Dev",
"gender": 0,
"has_password": true,
"image_url": "https://c8.patreon.com/2/400/0000000",
"is_deleted": false,
"is_email_verified": false,
"is_nuked": false,
"is_suspended": false,
"last_name": "The Dev",
"social_connections": {
"deviantart": null,
"discord": null,
"facebook": null,
"reddit": null,
"spotify": null,
"twitch": null,
"twitter": null,
"youtube": null
},
"thumb_url": "https://c8.patreon.com/2/100/0000000",
"twitch": null,
"twitter": null,
"url": "https://www.patreon.com/corgithedev",
"vanity": "corgithedev",
"youtube": null
},
"id": "0000000",
"relationships": {
"pledges": {
"data": []
}
},
"type": "user"
},
"links": {
"self": "https://www.patreon.com/api/user/0000000"
}
}
How would I get this What I need is discord_id fetch members maybe like
def discord_id(persons):
list = []
for person in persons
list.append(person.discord_id())
Is there away I can get person?
Was Very Helpful BTW
@codebard I found a way to get to patron info I use
pledge.relationships('patron')
But To Get Discord Id would I do
pledge.relationships('patron').attribute('social_connections').attribute('discord')
or am I doing something wrong there?
If you got the patron via the relationship of pledge (good idea), what you get with that info of patron would be what you get. What exactly you are receiving when you do that call? (by omitting any private info)
Well I don’t have any patrons yet but when the time comes we need the code ready so I am currently getting nothing
You can sign up for a new patron account via a different email, use the same payment method as your creator account, and subscribe to your creator account from a $1 tier or something. That would allow you to do live tests.
discord_id = pledger.relationship(“patron”).attribute(“social_connections”)[“discord”][“user_id”]
You were on the right track you just needed to change a few small things.