forked from iLinked1337/Anarchy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
iLinked1337
committed
Sep 22, 2019
1 parent
1a596eb
commit 57fae7e
Showing
36 changed files
with
301 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ public Image Image | |
} | ||
set | ||
{ | ||
_image.Image = value; | ||
_image.SetImage(value); | ||
} | ||
} | ||
#endregion | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Newtonsoft.Json.Linq; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Discord | ||
{ | ||
public static class NitroExtensions | ||
{ | ||
public static NitroGift GetNitroGift(this DiscordClient client, string code) | ||
{ | ||
return client.HttpClient.Get($"/entitlements/gift-codes/{code}?with_application=false&with_subscription_plan=true") | ||
.Deserialize<NitroGift>().SetClient(client); | ||
} | ||
|
||
|
||
public static void RedeemNitroGift(this DiscordClient client, string code, ulong? channelId = null) | ||
{ | ||
client.HttpClient.Post($"/entitlements/gift-codes/{code}/redeem", channelId.HasValue ? $"{{\"channel_id\":{channelId.Value}}}" : ""); | ||
} | ||
|
||
|
||
public static List<NitroBoost> GetNitroBoosts(this DiscordClient client) | ||
{ | ||
return client.HttpClient.Get("/users/@me/guilds/premium/subscriptions").Deserialize<List<NitroBoost>>(); | ||
} | ||
|
||
|
||
public static void BoostGuild(this DiscordClient client, ulong guildId) | ||
{ | ||
client.HttpClient.Put($"/guilds/{guildId}/premium/subscriptions"); | ||
} | ||
|
||
|
||
public static void RemoveGuildBoost(this DiscordClient client, ulong guildId, ulong subscriptionId) | ||
{ | ||
client.HttpClient.Delete($"/guilds/{guildId}/premium/subscriptions/{subscriptionId}"); | ||
} | ||
|
||
|
||
public static DateTime GetBoostCooldown(this DiscordClient client) | ||
{ | ||
return (DateTime)client.HttpClient.Get("/users/@me/guilds/premium/subscriptions/cooldown") | ||
.Deserialize<JObject>().GetValue("ends_at").ToObject(typeof(DateTime)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Discord | ||
{ | ||
public class NitroBoost | ||
{ | ||
[JsonProperty("id")] | ||
public ulong Id { get; private set; } | ||
|
||
|
||
[JsonProperty("guild_id")] | ||
public ulong GuildId { get; private set; } | ||
|
||
|
||
[JsonProperty("user_id")] | ||
public ulong UserId { get; private set; } | ||
|
||
|
||
[JsonProperty("ended")] | ||
public bool Ended { get; private set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using Newtonsoft.Json; | ||
|
||
namespace Discord | ||
{ | ||
public class NitroGift : Controllable | ||
{ | ||
[JsonProperty("subscription_plan")] | ||
public NitroSubscriptionPlan SubscriptionPlan { get; private set; } | ||
|
||
|
||
[JsonProperty("application_id")] | ||
public ulong ApplicationId { get; private set; } | ||
|
||
|
||
[JsonProperty("redeemed")] | ||
public bool Redeemed { get; private set; } | ||
|
||
|
||
[JsonProperty("expires_at")] | ||
#pragma warning disable CS0649 | ||
private readonly string _expiresAt; | ||
#pragma warning restore CS0649 | ||
|
||
|
||
public DateTime ExpiresAt | ||
{ | ||
get { return DiscordTimestamp.FromString(_expiresAt); } | ||
} | ||
|
||
|
||
[JsonProperty("code")] | ||
public string Code { get; private set; } | ||
|
||
|
||
[JsonProperty("user")] | ||
public User Gifter { get; private set; } | ||
|
||
|
||
[JsonProperty("max_uses")] | ||
public int MaxUses { get; private set; } | ||
|
||
|
||
[JsonProperty("id")] | ||
public ulong Id { get; private set; } | ||
|
||
|
||
[JsonProperty("summary")] | ||
public string Summary { get; private set; } | ||
|
||
|
||
public void Redeem(ulong? channelId = null) | ||
{ | ||
if (Redeemed) | ||
return; | ||
|
||
Client.RedeemNitroGift(Code, channelId); | ||
} | ||
|
||
|
||
public override string ToString() | ||
{ | ||
return SubscriptionPlan.Name; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Discord | ||
{ | ||
public class NitroSubscriptionPlan | ||
{ | ||
[JsonProperty("sku_id")] | ||
public ulong SkuId { get; private set; } | ||
|
||
|
||
[JsonProperty("name")] | ||
public string Name { get; private set; } | ||
|
||
|
||
[JsonProperty("currency")] | ||
public string Currency { get; private set; } | ||
|
||
|
||
[JsonProperty("price")] | ||
public int Price { get; private set; } | ||
|
||
|
||
[JsonProperty("tax_inclusive")] | ||
public bool TaxInclusive { get; private set; } | ||
|
||
|
||
[JsonProperty("id")] | ||
public ulong Id { get; private set; } | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.