Support listening/watching activity types

This resolves #931

As part of this change, StreamingType has been refactored to realign
with how Discord seems to define the 'type' field on activities now.

StreamType is renamed to ActivityType, and the following properties have
been changed:
- NotStreaming -> Playing
- Twitch -> Streaming

Additionally, the StreamType property/parameter has been removed from
StreamingGame, and moved up a scope to Game.

Normal Games may now set their type, to line up with changes in
Discord's official clients.
This commit is contained in:
Christopher F
2018-01-13 23:20:04 -05:00
parent f69ef2a8ca
commit a384ce02ab
10 changed files with 37 additions and 42 deletions

View File

@@ -0,0 +1,10 @@
namespace Discord
{
public enum ActivityType
{
Playing = 0,
Streaming = 1,
Listening = 2,
Watching = 3
}
}

View File

@@ -6,11 +6,13 @@ namespace Discord
public class Game : IActivity
{
public string Name { get; internal set; }
public ActivityType Type { get; internal set; }
internal Game() { }
public Game(string name)
public Game(string name, ActivityType type = ActivityType.Playing)
{
Name = name;
Type = type;
}
public override string ToString() => Name;

View File

@@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Discord
namespace Discord
{
public interface IActivity
{
string Name { get; }
ActivityType Type { get; }
}
}

View File

@@ -6,15 +6,14 @@ namespace Discord
public class StreamingGame : Game
{
public string Url { get; internal set; }
public StreamType StreamType { get; internal set; }
public StreamingGame(string name, string url, StreamType streamType)
public StreamingGame(string name, string url)
{
Name = name;
Url = url;
StreamType = streamType;
Type = ActivityType.Streaming;
}
public override string ToString() => Name;
private string DebuggerDisplay => $"{Name} ({Url})";
}

View File

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