private async Task DiscordShardedClientOnShardReady(DiscordSocketClient arg) { if (ShardReady != null) { await ShardReady.Invoke(this, arg).ConfigureAwait(false); } }
/// <summary> /// Constructs a new <see cref="DiscordShardedClientAbstraction"/> around an existing <see cref="WebSocket.DiscordShardedClient"/>. /// </summary> /// <param name="discordShardedClient">The value to use for <see cref="WebSocket.DiscordShardedClient"/>.</param> /// <exception cref="ArgumentNullException">Throws for <paramref name="discordShardedClient"/>.</exception> public DiscordShardedClientAbstraction(DiscordShardedClient discordShardedClient) : base(discordShardedClient) { discordShardedClient.ShardConnected += x => ShardConnected?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask; discordShardedClient.ShardDisconnected += (x, y) => ShardDisconnected?.InvokeAsync(x, y.Abstract()) ?? Task.CompletedTask; discordShardedClient.ShardLatencyUpdated += (x, y, z) => ShardLatencyUpdated?.InvokeAsync(x, y, z.Abstract()) ?? Task.CompletedTask; discordShardedClient.ShardReady += x => ShardReady?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask; }