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

@@ -1,4 +1,4 @@
using Discord.API;
using Discord.API;
using Discord.Rest;
using System;
using System.Collections.Generic;
@@ -238,13 +238,13 @@ namespace Discord.WebSocket
for (int i = 0; i < _shards.Length; i++)
await _shards[i].SetStatusAsync(status).ConfigureAwait(false);
}
public override async Task SetGameAsync(string name, string streamUrl = null, StreamType streamType = StreamType.NotStreaming)
public override async Task SetGameAsync(string name, string streamUrl = null, ActivityType type = ActivityType.Playing)
{
IActivity activity = null;
if (streamUrl != null)
activity = new StreamingGame(name, streamUrl, streamType);
else if (name != null)
activity = new Game(name);
if (!string.IsNullOrEmpty(streamUrl))
activity = new StreamingGame(name, streamUrl);
else if (!string.IsNullOrEmpty(name))
activity = new Game(name, type);
await SetActivityAsync(activity).ConfigureAwait(false);
}
public override async Task SetActivityAsync(IActivity activity)