Added Game model

This commit is contained in:
RogueException
2016-05-14 21:03:29 -03:00
parent c01e3c069d
commit f5045f2a67
7 changed files with 44 additions and 3 deletions

View File

@@ -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; }
}
}

View File

@@ -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;
}
}
}

View File

@@ -7,7 +7,7 @@ namespace Discord
/// <summary> Gets the url to this user's avatar. </summary>
string AvatarUrl { get; }
/// <summary> Gets the game this user is currently playing, if any. </summary>
string CurrentGame { get; }
Game? CurrentGame { get; }
/// <summary> Gets the per-username unique id for this user. </summary>
ushort Discriminator { get; }
/// <summary> Returns true if this user is a bot account. </summary>

View File

@@ -0,0 +1,8 @@
namespace Discord
{
public enum StreamType
{
NotStreaming = 0,
Twitch = 1
}
}

View File

@@ -49,6 +49,7 @@
<Compile Include="API\Common\EmbedProvider.cs" />
<Compile Include="API\Common\EmbedThumbnail.cs" />
<Compile Include="API\Common\Emoji.cs" />
<Compile Include="API\Common\Game.cs" />
<Compile Include="API\Common\Guild.cs" />
<Compile Include="API\Common\GuildEmbed.cs" />
<Compile Include="API\Common\GuildMember.cs" />
@@ -100,6 +101,8 @@
<Compile Include="API\Rest\ModifyTextChannelParams.cs" />
<Compile Include="API\Rest\ModifyVoiceChannelParams.cs" />
<Compile Include="API\WebSocketMessage.cs" />
<Compile Include="Common\Entities\Users\Game.cs" />
<Compile Include="Common\Entities\Users\StreamType.cs" />
<Compile Include="DiscordConfig.cs" />
<Compile Include="API\DiscordRawClient.cs" />
<Compile Include="Net\Converters\OptionalContractResolver.cs" />

View File

@@ -54,7 +54,7 @@ namespace Discord.Rest
public override string ToString() => $"{Username ?? Id.ToString()}";
/// <inheritdoc />
string IUser.CurrentGame => null;
Game? IUser.CurrentGame => null;
/// <inheritdoc />
UserStatus IUser.Status => UserStatus.Unknown;

View File

@@ -54,7 +54,7 @@ namespace Discord.WebSocket
public override string ToString() => $"{Username ?? Id.ToString()}";
/// <inheritdoc />
string IUser.CurrentGame => null;
Game? IUser.CurrentGame => null;
/// <inheritdoc />
UserStatus IUser.Status => UserStatus.Unknown;