From c012261cd17f72ce45e057ce8e2cdb71504d131a Mon Sep 17 00:00:00 2001 From: Christopher F Date: Sat, 23 Apr 2016 21:22:39 -0400 Subject: [PATCH 1/2] Add `User.IsBot` field, bump version number to 0.9rc4 A few users requested an IsBot field for marking Bot Accounts; Bumping Version number because it has been 0.9-rc3 forever and that's caused a bit of confusion in the channel with what version users are on. --- src/Discord.Net/API/Client/Common/UserReference.cs | 2 ++ src/Discord.Net/Models/User.cs | 6 ++++++ src/Discord.Net/project.json | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net/API/Client/Common/UserReference.cs b/src/Discord.Net/API/Client/Common/UserReference.cs index f2223df87..24dc91d52 100644 --- a/src/Discord.Net/API/Client/Common/UserReference.cs +++ b/src/Discord.Net/API/Client/Common/UserReference.cs @@ -13,5 +13,7 @@ namespace Discord.API.Client public ushort? Discriminator { get; set; } [JsonProperty("avatar")] public string Avatar { get; set; } + [JsonProperty("bot")] + public bool? Bot { get; set; } } } diff --git a/src/Discord.Net/Models/User.cs b/src/Discord.Net/Models/User.cs index 09735d71c..a6068eadc 100644 --- a/src/Discord.Net/Models/User.cs +++ b/src/Discord.Net/Models/User.cs @@ -62,6 +62,8 @@ namespace Discord public string AvatarId { get; private set; } /// Gets the name of the game this user is currently playing. public string CurrentGame { get; internal set; } + /// Determines whether this user is a Bot account. + public bool IsBot { get; internal set; } /// Gets the current status for this user. public UserStatus Status { get; internal set; } /// Gets the datetime that this user joined this server. @@ -160,6 +162,10 @@ namespace Discord Discriminator = model.Discriminator.Value; if (model.Avatar != null) AvatarId = model.Avatar; + if (model.Bot != null) + IsBot = model.Bot.Value; + if (model.Bot == null) IsBot = false; + } internal void Update(APIMember model) { diff --git a/src/Discord.Net/project.json b/src/Discord.Net/project.json index 565bc2e86..fd8ac91ed 100644 --- a/src/Discord.Net/project.json +++ b/src/Discord.Net/project.json @@ -1,5 +1,5 @@ { - "version": "0.9.0-rc3-3", + "version": "0.9.1", "description": "An unofficial .Net API wrapper for the Discord client.", "authors": [ "RogueException" From 789419ac86a661b32cfe6f8b3183d9b6271b3b18 Mon Sep 17 00:00:00 2001 From: Christopher F Date: Sat, 23 Apr 2016 21:31:29 -0400 Subject: [PATCH 2/2] don't check for null and default to false --- src/Discord.Net/Models/User.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Discord.Net/Models/User.cs b/src/Discord.Net/Models/User.cs index a6068eadc..3e431ac58 100644 --- a/src/Discord.Net/Models/User.cs +++ b/src/Discord.Net/Models/User.cs @@ -164,7 +164,6 @@ namespace Discord AvatarId = model.Avatar; if (model.Bot != null) IsBot = model.Bot.Value; - if (model.Bot == null) IsBot = false; } internal void Update(APIMember model)