/// <summary>
 /// Constructs a new <see cref="BaseSocketClientAbstraction"/> around an existing <see cref="WebSocket.BaseSocketClient"/>.
 /// </summary>
 /// <param name="baseSocketClient">The value to use for <see cref="WebSocket.BaseSocketClient"/>.</param>
 /// <exception cref="ArgumentNullException">Throws for <paramref name="baseSocketClient"/>.</exception>
 protected BaseSocketClientAbstraction(BaseSocketClient baseSocketClient)
     : base(baseSocketClient)
 {
     baseSocketClient.ChannelCreated         += x => ChannelCreated?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.ChannelDestroyed       += x => ChannelDestroyed?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.ChannelUpdated         += (x, y) => ChannelUpdated?.InvokeAsync(x.Abstract(), y.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.CurrentUserUpdated     += (x, y) => CurrentUserUpdated?.InvokeAsync(x.Abstract(), y.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.GuildAvailable         += x => GuildAvailable?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.GuildMembersDownloaded += x => GuildMembersDownloaded?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.GuildMemberUpdated     += (x, y) => GuildMemberUpdated?.InvokeAsync(x.Abstract(), y.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.GuildUnavailable       += x => GuildUnavailable?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.GuildUpdated           += (x, y) => GuildUpdated?.InvokeAsync(x.Abstract(), y.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.JoinedGuild            += x => JoinedGuild?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.LeftGuild             += x => LeftGuild?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.MessageReceived       += x => MessageReceived?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.MessageUpdated        += (x, y, z) => MessageUpdated?.InvokeAsync(x.Abstract(), y.Abstract(), z.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.MessageDeleted        += (x, y) => MessageDeleted?.InvokeAsync(x.Abstract(), y.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.ReactionAdded         += (x, y, z) => ReactionAdded?.InvokeAsync(x.Abstract(), y.Abstract(), z.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.ReactionRemoved       += (x, y, z) => ReactionRemoved?.InvokeAsync(x.Abstract(), y.Abstract(), z.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.ReactionsCleared      += (x, y) => ReactionsCleared?.InvokeAsync(x.Abstract(), y.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.RecipientAdded        += x => RecipientAdded?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.RecipientRemoved      += x => RecipientRemoved?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.RoleCreated           += x => RoleCreated?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.RoleDeleted           += x => RoleDeleted?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.RoleUpdated           += (x, y) => RoleUpdated?.InvokeAsync(x.Abstract(), y.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.UserBanned            += (x, y) => UserBanned?.InvokeAsync(x.Abstract(), y.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.UserIsTyping          += (x, y) => UserIsTyping?.InvokeAsync(x.Abstract(), y.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.UserJoined            += x => UserJoined?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.UserLeft              += x => UserLeft?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.UserUnbanned          += (x, y) => UserUnbanned?.InvokeAsync(x.Abstract(), y.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.UserUpdated           += (x, y) => UserUpdated?.InvokeAsync(x.Abstract(), y.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.UserVoiceStateUpdated += (x, y, z) => UserVoiceStateUpdated?.InvokeAsync(x.Abstract(), y.Abstract(), z.Abstract()) ?? Task.CompletedTask;
     baseSocketClient.VoiceServerUpdated    += x => VoiceServerUpdated?.InvokeAsync(x.Abstract()) ?? Task.CompletedTask;
 }
Beispiel #2
0
 private async Task DiscordShardedClientOnChannelDestroyed(SocketChannel arg)
 {
     if (ChannelDestroyed != null)
     {
         await ChannelDestroyed.Invoke(this, arg).ConfigureAwait(false);
     }
 }
Beispiel #3
0
 internal async Task OnChannelDestroyed(SocketChannel x) => await(ChannelDestroyed?.Invoke(x) ?? Task.CompletedTask);
 private void AriClient_OnChannelDestroyedEvent(IAriClient sender, ChannelDestroyedEvent e)
 {
     ChannelDestroyed?.Invoke(this, e);
 }