Browse Source

Added Game model

tags/1.0-rc
RogueException 9 years ago
parent
commit
f5045f2a67
7 changed files with 44 additions and 3 deletions
  1. +14
    -0
      src/Discord.Net/API/Common/Game.cs
  2. +16
    -0
      src/Discord.Net/Common/Entities/Users/Game.cs
  3. +1
    -1
      src/Discord.Net/Common/Entities/Users/IUser.cs
  4. +8
    -0
      src/Discord.Net/Common/Entities/Users/StreamType.cs
  5. +3
    -0
      src/Discord.Net/Discord.Net.csproj
  6. +1
    -1
      src/Discord.Net/Rest/Entities/Users/User.cs
  7. +1
    -1
      src/Discord.Net/WebSocket/Entities/Users/User.cs

+ 14
- 0
src/Discord.Net/API/Common/Game.cs 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; }
}
}

+ 16
- 0
src/Discord.Net/Common/Entities/Users/Game.cs 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;
}
}
}

+ 1
- 1
src/Discord.Net/Common/Entities/Users/IUser.cs 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>


+ 8
- 0
src/Discord.Net/Common/Entities/Users/StreamType.cs View File

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

+ 3
- 0
src/Discord.Net/Discord.Net.csproj 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" />


+ 1
- 1
src/Discord.Net/Rest/Entities/Users/User.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;



+ 1
- 1
src/Discord.Net/WebSocket/Entities/Users/User.cs 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;



Loading…
Cancel
Save