diff --git a/src/Discord.Net/API/Common/Game.cs b/src/Discord.Net/API/Common/Game.cs new file mode 100644 index 00000000..a5bbbfcd --- /dev/null +++ b/src/Discord.Net/API/Common/Game.cs @@ -0,0 +1,14 @@ +using Newtonsoft.Json; + +namespace Discord.API +{ + public class Game + { + [JsonProperty("name")] + public string Name { get; set; } + [JsonProperty("url")] + public string StreamUrl { get; set; } + [JsonProperty("type")] + public StreamType StreamType { get; set; } + } +} diff --git a/src/Discord.Net/Common/Entities/Users/Game.cs b/src/Discord.Net/Common/Entities/Users/Game.cs new file mode 100644 index 00000000..51d9c0b1 --- /dev/null +++ b/src/Discord.Net/Common/Entities/Users/Game.cs @@ -0,0 +1,16 @@ +namespace Discord +{ + public struct Game + { + public string Name { get; } + public string StreamUrl { get; } + public StreamType StreamType { get; } + + public Game(string name, string streamUrl, StreamType type) + { + Name = name; + StreamUrl = streamUrl; + StreamType = type; + } + } +} diff --git a/src/Discord.Net/Common/Entities/Users/IUser.cs b/src/Discord.Net/Common/Entities/Users/IUser.cs index 550c53e8..9808c4a9 100644 --- a/src/Discord.Net/Common/Entities/Users/IUser.cs +++ b/src/Discord.Net/Common/Entities/Users/IUser.cs @@ -7,7 +7,7 @@ namespace Discord /// Gets the url to this user's avatar. string AvatarUrl { get; } /// Gets the game this user is currently playing, if any. - string CurrentGame { get; } + Game? CurrentGame { get; } /// Gets the per-username unique id for this user. ushort Discriminator { get; } /// Returns true if this user is a bot account. diff --git a/src/Discord.Net/Common/Entities/Users/StreamType.cs b/src/Discord.Net/Common/Entities/Users/StreamType.cs new file mode 100644 index 00000000..7622e3d6 --- /dev/null +++ b/src/Discord.Net/Common/Entities/Users/StreamType.cs @@ -0,0 +1,8 @@ +namespace Discord +{ + public enum StreamType + { + NotStreaming = 0, + Twitch = 1 + } +} diff --git a/src/Discord.Net/Discord.Net.csproj b/src/Discord.Net/Discord.Net.csproj index 88794a5a..0d8fb670 100644 --- a/src/Discord.Net/Discord.Net.csproj +++ b/src/Discord.Net/Discord.Net.csproj @@ -49,6 +49,7 @@ + @@ -100,6 +101,8 @@ + + diff --git a/src/Discord.Net/Rest/Entities/Users/User.cs b/src/Discord.Net/Rest/Entities/Users/User.cs index eca5ff5c..0fe02bac 100644 --- a/src/Discord.Net/Rest/Entities/Users/User.cs +++ b/src/Discord.Net/Rest/Entities/Users/User.cs @@ -54,7 +54,7 @@ namespace Discord.Rest public override string ToString() => $"{Username ?? Id.ToString()}"; /// - string IUser.CurrentGame => null; + Game? IUser.CurrentGame => null; /// UserStatus IUser.Status => UserStatus.Unknown; diff --git a/src/Discord.Net/WebSocket/Entities/Users/User.cs b/src/Discord.Net/WebSocket/Entities/Users/User.cs index 6cda730c..b757cd00 100644 --- a/src/Discord.Net/WebSocket/Entities/Users/User.cs +++ b/src/Discord.Net/WebSocket/Entities/Users/User.cs @@ -54,7 +54,7 @@ namespace Discord.WebSocket public override string ToString() => $"{Username ?? Id.ToString()}"; /// - string IUser.CurrentGame => null; + Game? IUser.CurrentGame => null; /// UserStatus IUser.Status => UserStatus.Unknown;