Skip to content
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

Add your Patreon profile to your artist profile #32

Open
Anheledir opened this issue Mar 9, 2023 · 1 comment
Open

Add your Patreon profile to your artist profile #32

Anheledir opened this issue Mar 9, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Anheledir
Copy link
Owner

Anheledir commented Mar 9, 2023

As artist you can connect your bot profile to your Patreon-Account and also link your patreon tiers to roles on the server.

  • Show the amount of patrons in your profile
  • Link to your patron site
  • Link Patreon tiers to server roles
  • Get the list of your Patreon members with their pledge level and their Discord-Account for automatic role assignment
  • Add a possibility to add automatic loyalty points with each payment based on the pledge level

API-Documentation: https://docs.patreon.com/#user-v2

Sample code:

using System;
using System.Collections.Generic;
using System.Net.Http;
using Newtonsoft.Json;

class Program
{
    static async System.Threading.Tasks.Task Main(string[] args)
    {
        // Replace the placeholders with your actual values
        string campaignId = "your_campaign_id";
        string accessToken = "your_access_token";

        // Define the endpoint URL and headers
        string endpoint = $"https://www.patreon.com/api/oauth2/v2/campaigns/{campaignId}/members";
        HttpClient client = new HttpClient();
        client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");

        // Send the API request
        HttpResponseMessage response = await client.GetAsync(endpoint);

        // Parse the response JSON to extract the member data
        string responseContent = await response.Content.ReadAsStringAsync();
        dynamic jsonResponse = JsonConvert.DeserializeObject(responseContent);
        List<dynamic> members = jsonResponse.data.ToObject<List<dynamic>>();

        // Print the member data
        foreach (dynamic member in members)
        {
            decimal pledgeAmount = member.attributes.currently_entitled_amount_cents / 100.0m;
            string discordId = member.attributes.discord_id;
            Console.WriteLine($"Discord ID: {discordId}, Pledge Amount: ${pledgeAmount}");
        }
    }
}
@Anheledir Anheledir self-assigned this Mar 9, 2023
@Anheledir Anheledir added the enhancement New feature or request label Mar 9, 2023
@Anheledir Anheledir added this to the v0.5 milestone Mar 9, 2023
@Aralyre
Copy link

Aralyre commented Mar 9, 2023

AMAZING IDEA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants