Fixed patreon error

This commit is contained in:
Master Kwoth
2017-10-29 09:25:50 +01:00
parent 83194fca6e
commit a17de3dc58
2 changed files with 7 additions and 4 deletions

View File

@ -93,9 +93,12 @@ namespace NadekoBot.Modules.Utility.Services
var pledgers = data.Data.Where(x => x["type"].ToString() == "pledge");
rewards.AddRange(pledgers.Select(x => JsonConvert.DeserializeObject<PatreonPledge>(x.ToString()))
.Where(x => x.attributes.declined_since == null));
users.AddRange(data.Included
.Where(x => x["type"].ToString() == "user")
.Select(x => JsonConvert.DeserializeObject<PatreonUser>(x.ToString())));
if (data.Included != null)
{
users.AddRange(data.Included
.Where(x => x["type"].ToString() == "user")
.Select(x => JsonConvert.DeserializeObject<PatreonUser>(x.ToString())));
}
} while (!string.IsNullOrWhiteSpace(data.Links.next));
}
var db = _cache.Redis.GetDatabase();