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:
10
src/Discord.Net.Core/Entities/Activities/ActivityType.cs
Normal file
10
src/Discord.Net.Core/Entities/Activities/ActivityType.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Discord
|
||||
{
|
||||
public enum ActivityType
|
||||
{
|
||||
Playing = 0,
|
||||
Streaming = 1,
|
||||
Listening = 2,
|
||||
Watching = 3
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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})";
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Discord
|
||||
{
|
||||
public enum StreamType
|
||||
{
|
||||
NotStreaming = 0,
|
||||
Twitch = 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user