Added Game model
This commit is contained in:
14
src/Discord.Net/API/Common/Game.cs
Normal file
14
src/Discord.Net/API/Common/Game.cs
Normal 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
src/Discord.Net/Common/Entities/Users/Game.cs
Normal file
16
src/Discord.Net/Common/Entities/Users/Game.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
src/Discord.Net/Common/Entities/Users/StreamType.cs
Normal file
8
src/Discord.Net/Common/Entities/Users/StreamType.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Discord
|
||||
{
|
||||
public enum StreamType
|
||||
{
|
||||
NotStreaming = 0,
|
||||
Twitch = 1
|
||||
}
|
||||
}
|
||||
@@ -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" />
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user