diff --git a/src/Discord.Net.Net45/Discord.Net.csproj b/src/Discord.Net.Net45/Discord.Net.csproj
index a2592d251..68b3adb16 100644
--- a/src/Discord.Net.Net45/Discord.Net.csproj
+++ b/src/Discord.Net.Net45/Discord.Net.csproj
@@ -604,6 +604,8 @@
TaskManager.cs
+
+
diff --git a/src/Discord.Net.Net45/Enums/GameType.cs b/src/Discord.Net.Net45/Enums/GameType.cs
new file mode 100644
index 000000000..446271b47
--- /dev/null
+++ b/src/Discord.Net.Net45/Enums/GameType.cs
@@ -0,0 +1,8 @@
+namespace Discord
+{
+ public enum GameType : int
+ {
+ Default = 0, // "NotStreaming", pretty much
+ Twitch
+ }
+}
diff --git a/src/Discord.Net.Net45/Models/Game.cs b/src/Discord.Net.Net45/Models/Game.cs
new file mode 100644
index 000000000..721486222
--- /dev/null
+++ b/src/Discord.Net.Net45/Models/Game.cs
@@ -0,0 +1,14 @@
+using Newtonsoft.Json;
+
+namespace Discord
+{
+ public class GameInfo
+ {
+ [JsonProperty("game")]
+ public string Name { get; set; }
+ [JsonProperty("url")]
+ public string Url { get; set; }
+ [JsonProperty("type")]
+ public GameType Type { get; set; }
+ }
+}
diff --git a/src/Discord.Net/API/Client/Common/MemberPresence.cs b/src/Discord.Net/API/Client/Common/MemberPresence.cs
index 589ad46c1..fa8dd06e6 100644
--- a/src/Discord.Net/API/Client/Common/MemberPresence.cs
+++ b/src/Discord.Net/API/Client/Common/MemberPresence.cs
@@ -5,11 +5,6 @@ namespace Discord.API.Client
{
public class MemberPresence : MemberReference
{
- public class GameInfo
- {
- [JsonProperty("name")]
- public string Name { get; set; }
- }
[JsonProperty("game")]
public GameInfo Game { get; set; }
[JsonProperty("status")]
diff --git a/src/Discord.Net/API/Client/GatewaySocket/Commands/UpdateStatus.cs b/src/Discord.Net/API/Client/GatewaySocket/Commands/UpdateStatus.cs
index dff18b08c..5adf3ada8 100644
--- a/src/Discord.Net/API/Client/GatewaySocket/Commands/UpdateStatus.cs
+++ b/src/Discord.Net/API/Client/GatewaySocket/Commands/UpdateStatus.cs
@@ -9,12 +9,6 @@ namespace Discord.API.Client.GatewaySocket
object IWebSocketMessage.Payload => this;
bool IWebSocketMessage.IsPrivate => false;
- public class GameInfo
- {
- [JsonProperty("name")]
- public string Name { get; set; }
- }
-
[JsonProperty("idle_since")]
public long? IdleSince { get; set; }
[JsonProperty("game")]
diff --git a/src/Discord.Net/DiscordClient.cs b/src/Discord.Net/DiscordClient.cs
index de2797b1e..3b986c7c8 100644
--- a/src/Discord.Net/DiscordClient.cs
+++ b/src/Discord.Net/DiscordClient.cs
@@ -65,7 +65,7 @@ namespace Discord
/// Gets the status of the current user.
public UserStatus Status { get; private set; }
/// Gets the game the current user is displayed as playing.
- public string CurrentGame { get; private set; }
+ public GameInfo CurrentGame { get; private set; }
/// Gets a collection of all extensions added to this DiscordClient.
public IEnumerable Services => _services;
@@ -316,11 +316,20 @@ namespace Discord
Status = status;
SendStatus();
}
- public void SetGame(string game)
+ public void SetGame(GameInfo game)
{
CurrentGame = game;
SendStatus();
}
+ public void SetGame(string game, string url = null, GameType type = 0)
+ {
+ CurrentGame = new GameInfo() {
+ Name = game,
+ Url = url ?? CurrentGame.Url,
+ Type = type
+ };
+ SendStatus();
+ }
private void SendStatus()
{
PrivateUser.Status = Status;
diff --git a/src/Discord.Net/Enums/GameType.cs b/src/Discord.Net/Enums/GameType.cs
new file mode 100644
index 000000000..446271b47
--- /dev/null
+++ b/src/Discord.Net/Enums/GameType.cs
@@ -0,0 +1,8 @@
+namespace Discord
+{
+ public enum GameType : int
+ {
+ Default = 0, // "NotStreaming", pretty much
+ Twitch
+ }
+}
diff --git a/src/Discord.Net/Models/Game.cs b/src/Discord.Net/Models/Game.cs
new file mode 100644
index 000000000..83109d12c
--- /dev/null
+++ b/src/Discord.Net/Models/Game.cs
@@ -0,0 +1,9 @@
+namespace Discord
+{
+ public class GameInfo
+ {
+ public string Name { get; set; }
+ public string Url { get; set; }
+ public GameType Type { get; set; }
+ }
+}
diff --git a/src/Discord.Net/Models/Profile.cs b/src/Discord.Net/Models/Profile.cs
index 89cdde640..245d45072 100644
--- a/src/Discord.Net/Models/Profile.cs
+++ b/src/Discord.Net/Models/Profile.cs
@@ -23,7 +23,7 @@ namespace Discord
/// Gets an id uniquely identifying from others with the same name.
public ushort Discriminator => Client.PrivateUser.Discriminator;
/// Gets the name of the game this user is currently playing.
- public string CurrentGame => Client.PrivateUser.CurrentGame;
+ public GameInfo CurrentGame => Client.PrivateUser.CurrentGame;
/// Gets the current status for this user.
public UserStatus Status => Client.PrivateUser.Status;
/// Returns the string used to mention this user.
diff --git a/src/Discord.Net/Models/User.cs b/src/Discord.Net/Models/User.cs
index c3635cf02..ba43f439f 100644
--- a/src/Discord.Net/Models/User.cs
+++ b/src/Discord.Net/Models/User.cs
@@ -63,7 +63,7 @@ namespace Discord
/// Gets the unique identifier for this user's current avatar.
public string AvatarId { get; private set; }
/// Gets the name of the game this user is currently playing.
- public string CurrentGame { get; internal set; }
+ public GameInfo 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.
@@ -208,7 +208,7 @@ namespace Discord
_lastOnline = DateTime.UtcNow;
}
- CurrentGame = model.Game?.Name; //Allows null
+ CurrentGame = model.Game; //Allows null
}
internal void Update(MemberVoiceState model)
{
diff --git a/src/Discord.Net/Net/WebSockets/GatewaySocket.cs b/src/Discord.Net/Net/WebSockets/GatewaySocket.cs
index cbd0afcf7..ddfa3d3e5 100644
--- a/src/Discord.Net/Net/WebSockets/GatewaySocket.cs
+++ b/src/Discord.Net/Net/WebSockets/GatewaySocket.cs
@@ -167,11 +167,11 @@ namespace Discord.Net.WebSockets
=> QueueMessage(new ResumeCommand { SessionId = SessionId, Sequence = _lastSequence });
public override void SendHeartbeat()
=> QueueMessage(new HeartbeatCommand());
- public void SendUpdateStatus(long? idleSince, string gameName)
+ public void SendUpdateStatus(long? idleSince, GameInfo game)
=> QueueMessage(new UpdateStatusCommand
{
IdleSince = idleSince,
- Game = gameName != null ? new UpdateStatusCommand.GameInfo { Name = gameName } : null
+ Game = game != null ? new GameInfo { Name = game.Name, Url = game.Url, Type = game.Type } : null
});
public void SendUpdateVoice(ulong? serverId, ulong? channelId, bool isSelfMuted, bool isSelfDeafened)
=> QueueMessage(new UpdateVoiceCommand { GuildId = serverId, ChannelId = channelId, IsSelfMuted = isSelfMuted, IsSelfDeafened = isSelfDeafened });