| @@ -45,6 +45,7 @@ namespace Discord.WebSocket | |||||
| public abstract Task StopAsync(); | public abstract Task StopAsync(); | ||||
| public abstract Task SetStatusAsync(UserStatus status); | public abstract Task SetStatusAsync(UserStatus status); | ||||
| public abstract Task SetGameAsync(string name, string streamUrl = null, StreamType streamType = StreamType.NotStreaming); | public abstract Task SetGameAsync(string name, string streamUrl = null, StreamType streamType = StreamType.NotStreaming); | ||||
| public abstract Task SetActivityAsync(IActivity activity); | |||||
| public abstract Task DownloadUsersAsync(IEnumerable<IGuild> guilds); | public abstract Task DownloadUsersAsync(IEnumerable<IGuild> guilds); | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| @@ -239,9 +239,18 @@ namespace Discord.WebSocket | |||||
| await _shards[i].SetStatusAsync(status).ConfigureAwait(false); | 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, StreamType streamType = StreamType.NotStreaming) | ||||
| { | |||||
| IActivity activity = null; | |||||
| if (streamUrl != null) | |||||
| activity = new StreamingGame(name, streamUrl, streamType); | |||||
| else if (name != null) | |||||
| activity = new Game(name); | |||||
| await SetActivityAsync(activity).ConfigureAwait(false); | |||||
| } | |||||
| public override async Task SetActivityAsync(IActivity activity) | |||||
| { | { | ||||
| for (int i = 0; i < _shards.Length; i++) | for (int i = 0; i < _shards.Length; i++) | ||||
| await _shards[i].SetGameAsync(name, streamUrl, streamType).ConfigureAwait(false); | |||||
| await _shards[i].SetActivityAsync(activity).ConfigureAwait(false); | |||||
| } | } | ||||
| private void RegisterEvents(DiscordSocketClient client, bool isPrimary) | private void RegisterEvents(DiscordSocketClient client, bool isPrimary) | ||||
| @@ -328,7 +328,7 @@ namespace Discord.WebSocket | |||||
| } | } | ||||
| public override async Task SetGameAsync(string name, string streamUrl = null, StreamType streamType = StreamType.NotStreaming) | public override async Task SetGameAsync(string name, string streamUrl = null, StreamType streamType = StreamType.NotStreaming) | ||||
| { | { | ||||
| if (name != null && streamUrl != null) | |||||
| if (streamUrl != null) | |||||
| Activity = new StreamingGame(name, streamUrl, streamType); | Activity = new StreamingGame(name, streamUrl, streamType); | ||||
| else if (name != null) | else if (name != null) | ||||
| Activity = new Game(name); | Activity = new Game(name); | ||||
| @@ -336,7 +336,7 @@ namespace Discord.WebSocket | |||||
| Activity = null; | Activity = null; | ||||
| await SendStatusAsync().ConfigureAwait(false); | await SendStatusAsync().ConfigureAwait(false); | ||||
| } | } | ||||
| public async Task SetActivityAsync(IActivity activity) | |||||
| public override async Task SetActivityAsync(IActivity activity) | |||||
| { | { | ||||
| Activity = activity; | Activity = activity; | ||||
| await SendStatusAsync().ConfigureAwait(false); | await SendStatusAsync().ConfigureAwait(false); | ||||