diff --git a/NetCord/Gateway/GatewayClient.cs b/NetCord/Gateway/GatewayClient.cs index c6d6e43f..75a5db4c 100644 --- a/NetCord/Gateway/GatewayClient.cs +++ b/NetCord/Gateway/GatewayClient.cs @@ -1,4 +1,4 @@ -using System.Runtime.CompilerServices; +using System.Runtime.CompilerServices; using System.Text.Json; using NetCord.Gateway.Compression; @@ -8,6 +8,9 @@ namespace NetCord.Gateway; +/// +/// The WebSocket-based client allows you to receive events from the Discord Gateway and update or request resources, such as updating voice state. +/// public partial class GatewayClient : WebSocketClient, IEntity { private readonly GatewayClientConfiguration _configuration; @@ -17,73 +20,627 @@ public partial class GatewayClient : WebSocketClient, IEntity private readonly IGatewayCompression _compression; private readonly bool _disposeRest; + #region Events + + /// + /// The ready event is dispatched when a client has completed the initial handshake with the Gateway (for new sessions). + /// The ready event contains all the state required for a client to begin interacting with the rest of the platform.
+ ///
Required Intents: None + ///
Optional Intents: None + ///
public event Func? Ready; + + /// + /// Sent when an application command's permissions are updated. + /// The inner payload is an object.
+ ///
Required Intents: None + ///
Optional Intents: None + ///
public event Func? ApplicationCommandPermissionsUpdate; + + /// + /// Sent when a rule is created. + /// The inner payload is an object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? AutoModerationRuleCreate; + + /// + /// Sent when a rule is updated. + /// The inner payload is an object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? AutoModerationRuleUpdate; + + /// + /// Sent when a rule is deleted. + /// The inner payload is an object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? AutoModerationRuleDelete; + + /// + /// Sent when a rule is triggered and an action is executed (e.g. when a message is blocked).
+ ///
Required Intents: + ///
Optional Intents: + /// + /// + /// + /// + /// + /// + /// For receiving and . + /// + /// + /// + ///
public event Func? AutoModerationActionExecution; + + /// + /// Sent when a new guild channel is created, relevant to the bot. + /// The inner payload is an object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildChannelCreate; + + /// + /// Sent when a channel is updated. This is not sent with new messages, those are tracked by and . This event may reference roles or guild members that no longer exist in the guild. + /// The inner payload is an object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildChannelUpdate; + + /// + /// Sent when a channel relevant to the bot is deleted. + /// The inner payload is an object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildChannelDelete; - public event Func? ChannelPinsUpdate; + + /// + /// Sent when a thread is created, relevant to the bot, or when the current user is added to a thread. + /// The inner payload is an object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildThreadCreate; + + /// + /// Sent when a thread is updated. This is not sent with new messages, those are tracked by . + /// The inner payload is an object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildThreadUpdate; + + /// + /// Sent when a thread relevant to the bot is deleted. + /// The inner payload is a subset of an object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildThreadDelete; + + /// + /// Sent when the current user gains access to a channel.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildThreadListSync; + + /// + /// Sent when the object for the bot is updated. This event is largely just a signal that you are a member of the thread. + /// The inner payload is a object with a set .
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildThreadUserUpdate; + + /// + /// Sent when anyone is added to or removed from a thread.
+ ///
Required Intents: , * + ///
Optional Intents: + /// + /// + /// + /// + /// + /// + /// For receiving this event when other users are added / removed, otherwise this event will only fire for the bot's user. + /// + /// + /// + ///

+ /// *Must also be enabled in the developer portal. + ///
public event Func? GuildThreadUsersUpdate; + + /// + /// Sent when a message is pinned or unpinned in a text channel. This is not sent when a pinned message is deleted.
+ ///
Required Intents: , + ///
Optional Intents: None + ///
+ public event Func? ChannelPinsUpdate; + + /// + /// Sent when an entitlement is created. + /// The inner payload is an object.
+ ///
Required Intents: None + ///
Optional Intents: None + ///
+ public event Func? EntitlementCreate; + + /// + /// Sent when an entitlement is updated. When an entitlement for a subscription is renewed, the field may have an updated value with the new expiration date. + /// The inner payload is an object.
+ ///
Required Intents: None + ///
Optional Intents: None + ///
+ public event Func? EntitlementUpdate; + + /// + /// Sent when an entitlement is deleted. Entitlements are not deleted when they expire. + /// The inner payload is an object.
+ ///
Required Intents: None + ///
Optional Intents: None + ///
+ public event Func? EntitlementDelete; + + /// + /// This event can be sent in three different scenarios (During an outage, the object in scenarios 1 and 3 may be marked as unavailable):
+ /// + /// + /// + /// To lazily load and backfill information for all unavailable guilds sent in the event. Guilds unavailable due to an outage will send a event. + /// + /// + /// + /// + /// When a guild becomes available again to the client. + /// + /// + /// + /// + /// When the current user joins a new guild. + /// + /// + /// + /// The inner payload can be a object with extra fields, or an unavailable object. If the guild has over 75k users, users and presences returned in this event will only contain your bot and users in voice channels.
+ ///
Required Intents: + ///
Optional Intents: + /// + /// + /// + /// + /// + /// + /// For receiving users and presences other than the bot's user and users in voice channels (Same as the 75k limit). + /// + /// + /// + ///
public event Func? GuildCreate; + + /// + /// Sent when a guild is updated. + /// The inner payload is a object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildUpdate; + + /// + /// Sent when a guild becomes or was already unavailable due to an outage, or when the bot leaves / is removed from a guild. + /// The inner payload is an unavailable guild object. If the field is not true, the bot was removed from the guild.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildDelete; + + /// + /// Sent when a guild audit log entry is created. + /// The inner payload is an object. This event is only sent to bots with the permission.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildAuditLogEntryCreate; + + /// + /// Sent when a user is banned from a guild.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildBanAdd; + + /// + /// Sent when a user is unbanned from a guild.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildBanRemove; + + /// + /// Sent when a guild's emojis have been updated.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildEmojisUpdate; + + /// + /// Sent when a guild's stickers have been updated.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildStickersUpdate; + + /// + /// Sent when guild integrations are updated.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildIntegrationsUpdate; + + /// + /// Sent when a new user joins a guild. + /// The inner payload is a object with an extra guild_id key.
+ ///
Required Intents: * + ///
Optional Intents: None + ///

+ /// *Must also be enabled in the developer portal. + ///
public event Func? GuildUserAdd; - public event Func? GuildUserUpdate; + + /// + /// Sent when a user is removed from a guild (leave/kick/ban).
+ ///
Required Intents: * + ///
Optional Intents: None + ///

+ /// *Must also be enabled in the developer portal. + ///
public event Func? GuildUserRemove; + + /// + /// Sent when a guild user is updated. This will also fire when the object of a guild user changes.
+ ///
Required Intents: * + ///
Optional Intents: None + ///

+ /// *Must also be enabled in the developer portal. + ///
+ public event Func? GuildUserUpdate; + + /// + /// Sent in response to . You can use the and to calculate how many chunks are left for your request.
+ ///
Required Intents: None + ///
Optional Intents: None + ///
public event Func? GuildUserChunk; + + /// + /// Sent when a guild role is created.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? RoleCreate; + + /// + /// Sent when a guild role is updated.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? RoleUpdate; + + /// + /// Sent when a guild role is deleted.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? RoleDelete; + + /// + /// Sent when a guild scheduled event is created. + /// The inner payload is a object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildScheduledEventCreate; + + /// + /// Sent when a guild scheduled event is updated. + /// The inner payload is a object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildScheduledEventUpdate; + + /// + /// Sent when a guild scheduled event is deleted. + /// The inner payload is a object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildScheduledEventDelete; + + /// + /// Sent when a user has subscribed to a guild scheduled event.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildScheduledEventUserAdd; + + /// + /// Sent when a user has unsubscribed from a guild scheduled event.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildScheduledEventUserRemove; + + /// + /// Sent when an integration is created. + /// The inner payload is an integration object with a set .
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildIntegrationCreate; + + /// + /// Sent when an integration is updated. + /// The inner payload is an integration object with a set .
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildIntegrationUpdate; + + /// + /// Sent when an integration is deleted.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildIntegrationDelete; + + /// + /// Sent when a new invite to a channel is created. Only sent if the bot has the permission for the relevant channel.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildInviteCreate; + + /// + /// Sent when an invite is deleted. Only sent if the bot has the permission for the relevant channel.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? GuildInviteDelete; + + /// + /// Sent when a message is created. + /// The inner payload is a message object with set , and fields.
+ ///
Required Intents: , * + ///
Optional Intents: + /// + /// + /// + /// + /// + /// + /// For receiving , , and .
+ /// This does not apply to: + /// + /// + /// + /// Content in messages sent by the bot. + /// + /// + /// + /// + /// Content in DMs with the bot. + /// + /// + /// + /// + /// Content in which the bot is mentioned. + /// + /// + /// + /// + /// Content of messages a message context menu command is used on. + /// + /// + /// + ///
+ ///
+ ///
+ ///

+ /// *Ephemeral messages do not use the guild channel. Because of this, they are tied to the intent, and the message object won't include a or . + ///
public event Func? MessageCreate; + + /// + /// Sent when a message is updated. + /// The inner payload is a partial message object, with only the message's ID and Guild ID being guaranteed present, all other fields can be null.
+ ///
Required Intents: , * + ///
Optional Intents: + /// + /// + /// + /// + /// + /// + /// For receiving , , and .
+ /// This does not apply to: + /// + /// + /// + /// Content in messages sent by the bot. + /// + /// + /// + /// + /// Content in DMs with the bot. + /// + /// + /// + /// + /// Content in which the bot is mentioned. + /// + /// + /// + /// + /// Content of messages a message context menu command is used on. + /// + /// + /// + ///
+ ///
+ ///
+ ///

+ /// *Ephemeral messages do not use the guild channel. Because of this, they are tied to the intent, and the message object won't include a or . + ///
public event Func? MessageUpdate; + + /// + /// Sent when a message is deleted.
+ ///
Required Intents: , + ///
Optional Intents: None + ///
public event Func? MessageDelete; + + /// + /// Sent when multiple messages are deleted at once.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? MessageDeleteBulk; + + /// + /// Sent when a user adds a reaction to a message.
+ ///
Required Intents: , + ///
Optional Intents: None + ///
public event Func? MessageReactionAdd; + + /// + /// Sent when a user removes a reaction from a message.
+ ///
Required Intents: , + ///
Optional Intents: None + ///
public event Func? MessageReactionRemove; + + /// + /// Sent when a user explicitly removes all reactions from a message.
+ ///
Required Intents: , + ///
Optional Intents: None + ///
public event Func? MessageReactionRemoveAll; + + /// + /// Sent when a user removes all instances of a given emoji from the reactions of a message.
+ ///
Required Intents: , + ///
Optional Intents: None + ///
public event Func? MessageReactionRemoveEmoji; + + /// + /// Sent when a user's presence or info, such as their name or avatar, is updated. Requires the intent. + /// The user object within this event can be partial, with the id being the only required field, everything else is optional. Along with this limitation, no fields are required, and the types of the fields are not validated. You should expect any combination of fields and types within this event.
+ ///
Required Intents: * + ///
Optional Intents: None + ///

+ /// *Must also be enabled in the developer portal. + ///
public event Func? PresenceUpdate; + + /// + /// Sent when a user starts typing in a channel, and fires again every 10 seconds while they continue typing.
+ ///
Required Intents: , + ///
Optional Intents: None + ///
public event Func? TypingStart; + + /// + /// Sent when properties about the current bot's user change. + /// Inner payload is a object.
+ ///
Required Intents: None + ///
Optional Intents: None + ///
public event Func? CurrentUserUpdate; + + /// + /// Sent when someone joins/leaves/moves voice channels. + /// Inner payload is a object.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? VoiceStateUpdate; + + /// + /// Sent when a guild's voice server is updated. This is sent when initially connecting to voice, and when the current voice instance fails over to a new server.
+ ///
Required Intents: None + ///
Optional Intents: None + ///
public event Func? VoiceServerUpdate; + + /// + /// Sent when a guild channel's webhook is created, updated, or deleted.
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? WebhooksUpdate; + + /// + /// Sent when a user uses an interaction. + /// Inner payload is an .
+ ///
Required Intents: None + ///
Optional Intents: None + ///
public event Func? InteractionCreate; + + /// + /// Sent when a is created (i.e. the Stage is now 'live'). + /// Inner payload is a .
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? StageInstanceCreate; + + /// + /// Sent when a is updated. + /// Inner payload is a .
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? StageInstanceUpdate; + + /// + /// Sent when a is deleted (i.e. the Stage has been closed). + /// Inner payload is a .
+ ///
Required Intents: + ///
Optional Intents: None + ///
public event Func? StageInstanceDelete; - public event Func? EntitlementCreate; - public event Func? EntitlementUpdate; - public event Func? EntitlementDelete; + + /// + /// Not documented by Discord. + /// public event Func? GuildJoinRequestUpdate; + + /// + /// Not documented by Discord. + /// public event Func? GuildJoinRequestDelete; + + /// + /// An unknown event. + /// public event Func? UnknownEvent; + #endregion + /// /// The token of the . /// @@ -123,6 +680,9 @@ public partial class GatewayClient : WebSocketClient, IEntity public DateTimeOffset CreatedAt => Token.CreatedAt; + /// + /// Constructs a using the given and . + /// public GatewayClient(IEntityToken token, GatewayClientConfiguration? configuration = null) : this(token, new(token, (configuration ??= new()).RestClientConfiguration), configuration) { _disposeRest = true; @@ -254,8 +814,6 @@ private protected override async Task ProcessPayloadAsync(JsonPayload payload) /// /// Joins, moves, or disconnects the app from a voice channel. /// - /// - /// public ValueTask UpdateVoiceStateAsync(VoiceStateProperties voiceState) { GatewayPayloadProperties payload = new(GatewayOpcode.VoiceStateUpdate, voiceState); @@ -266,7 +824,6 @@ public ValueTask UpdateVoiceStateAsync(VoiceStateProperties voiceState) /// Updates an app's presence. /// /// The presence to set. - /// public ValueTask UpdatePresenceAsync(PresenceProperties presence) { GatewayPayloadProperties payload = new(GatewayOpcode.PresenceUpdate, presence); @@ -276,8 +833,6 @@ public ValueTask UpdatePresenceAsync(PresenceProperties presence) /// /// Requests user for a guild. /// - /// - /// public ValueTask RequestGuildUsersAsync(GuildUsersRequestProperties requestProperties) { GatewayPayloadProperties payload = new(GatewayOpcode.RequestGuildUsers, requestProperties); diff --git a/NetCord/Gateway/GatewayIntents.cs b/NetCord/Gateway/GatewayIntents.cs index decb178c..20fd19bb 100644 --- a/NetCord/Gateway/GatewayIntents.cs +++ b/NetCord/Gateway/GatewayIntents.cs @@ -1,55 +1,159 @@ -namespace NetCord.Gateway; +namespace NetCord.Gateway; +/// +/// Intents are used to configure which events are passed to the bot via the gateway connection. Intents marked as privileged must be enabled in the application developer portal before being passed here, otherwise the connection will terminate with close code 4014. +/// [Flags] public enum GatewayIntents : uint { + /// + /// Associated with the following events: + /// + /// + /// + /// Guild Events: , ,
+ ///
+ ///
+ /// + /// + /// Role Events: , ,
+ ///
+ ///
+ /// + /// + /// Channel Events: , , ,
+ ///
+ ///
+ /// + /// + /// Thread Events: , , ,
+ ///
+ ///
+ /// + /// + /// Thread User Events: ,
+ ///
+ ///
+ /// + /// + /// Stage Events: , , + /// + /// + ///
+ ///
Guilds = 1 << 0, + /// - /// Privileged + /// Privileged, associated with the following events:
+ /// , , , ///
GuildUsers = 1 << 1, + + /// + /// Associated with the following events:
+ /// , , + ///
GuildModeration = 1 << 2, + + /// + /// Associated with the following events:
+ /// , + ///
GuildEmojisAndStickers = 1 << 3, + + /// + /// Associated with the following events:
+ /// , , , + ///
GuildIntegrations = 1 << 4, + + /// + /// Associated with the following events:
+ /// + ///
GuildWebhooks = 1 << 5, + + /// + /// Associated with the following events:
+ /// , + ///
GuildInvites = 1 << 6, + + /// + /// Associated with the following events:
+ /// + ///
GuildVoiceStates = 1 << 7, + /// - /// Privileged + /// Privileged, associated with the following events:
+ /// ///
GuildPresences = 1 << 8, + + /// + /// Associated with the following events:
+ /// , , , + ///
GuildMessages = 1 << 9, + + /// + /// Associated with the following events:
+ /// , , , + ///
GuildMessageReactions = 1 << 10, + + /// + /// Associated with the following events:
+ /// + ///
GuildMessageTyping = 1 << 11, + + /// + /// Associated with the following events:
+ /// , , , + ///
DirectMessages = 1 << 12, + + /// + /// Associated with the following events:
+ /// , , , + ///
DirectMessageReactions = 1 << 13, + + /// + /// Associated with the following events:
+ /// + ///
DirectMessageTyping = 1 << 14, + /// - /// Privileged + /// Privileged, ssociated with the following events:
+ /// , , , ///
MessageContent = 1 << 15, + + /// + /// Associated with the following events:
+ /// , , , , + ///
GuildScheduledEvents = 1 << 16, + + /// + /// Associated with the following events:
+ /// , , + ///
AutoModerationConfiguration = 1 << 20, + + /// + /// Associated with the following events:
+ /// + ///
AutoModerationExecution = 1 << 21, - All = Guilds - | GuildUsers - | GuildModeration - | GuildEmojisAndStickers - | GuildIntegrations - | GuildWebhooks - | GuildInvites - | GuildVoiceStates - | GuildPresences - | GuildMessages - | GuildMessageReactions - | GuildMessageTyping - | DirectMessages - | DirectMessageReactions - | DirectMessageTyping - | MessageContent - | GuildScheduledEvents - | AutoModerationConfiguration - | AutoModerationExecution, + + /// + /// Implies all available intents, excluding privileged intents. + /// AllNonPrivileged = Guilds | GuildModeration | GuildEmojisAndStickers @@ -66,4 +170,12 @@ public enum GatewayIntents : uint | GuildScheduledEvents | AutoModerationConfiguration | AutoModerationExecution, + + /// + /// Implies all available intents, including privileged intents. + /// + All = AllNonPrivileged + | GuildUsers + | GuildPresences + | MessageContent, } diff --git a/NetCord/Gateway/GatewayOpcode.cs b/NetCord/Gateway/GatewayOpcode.cs index 47d0cd87..6d4d9d42 100644 --- a/NetCord/Gateway/GatewayOpcode.cs +++ b/NetCord/Gateway/GatewayOpcode.cs @@ -1,16 +1,62 @@ namespace NetCord.Gateway; +/// +/// Contains all valid opcodes sent/received by the client. +/// internal enum GatewayOpcode : byte { + /// + /// An event was dispatched. + /// Dispatch = 0, + + /// + /// Fired periodically by the client to keep the connection alive. + /// Heartbeat = 1, + + /// + /// Starts a new session during the initial handshake. + /// Identify = 2, + + /// + /// Update the client's presence. + /// PresenceUpdate = 3, + + /// + /// Used to join/leave or move between voice channels. + /// VoiceStateUpdate = 4, + + /// + /// Resume a previous session that was disconnected. + /// Resume = 6, + + /// + /// You should attempt to reconnect and resume immediately. + /// Reconnect = 7, + + /// + /// Request information about offline guild members in a large guild. + /// RequestGuildUsers = 8, + + /// + /// The session has been invalidated. You should reconnect and identify/resume accordingly. + /// InvalidSession = 9, + + /// + /// Sent immediately after connecting, contains the heartbeat_interval to use. + /// Hello = 10, + + /// + /// Sent in response to receiving a heartbeat to acknowledge that it has been received. + /// HeartbeatACK = 11, } diff --git a/NetCord/Gateway/ShardedGatewayClient.cs b/NetCord/Gateway/ShardedGatewayClient.cs index 3a6d647e..2fa52a84 100644 --- a/NetCord/Gateway/ShardedGatewayClient.cs +++ b/NetCord/Gateway/ShardedGatewayClient.cs @@ -1,4 +1,4 @@ -using System.Collections; +using System.Collections; using NetCord.Rest; @@ -331,22 +331,6 @@ private void HookEvents(GatewayClient client) HookEvent(client, _unknownEventLock, ref _unknownEvent, a => _unknownEvent!(client, a), (c, e) => c.UnknownEvent += e); } - private readonly object _readyLock = new(); - private Func? _ready; - public event Func? Ready - { - add - { - HookEvent(_readyLock, value, ref _ready, client => a => _ready!(client, a), (c, e) => c.Ready += e); - } - remove - { - UnhookEvent(_readyLock, value, ref _ready, (c, e) => c.Ready -= e); - } - } - - private readonly object _latencyUpdateLock = new(); - private Func? _latencyUpdate; public event Func? LatencyUpdate { add @@ -358,9 +342,9 @@ public event Func? LatencyUpdate UnhookEvent(_latencyUpdateLock, value, ref _latencyUpdate, (c, e) => c.LatencyUpdate -= e); } } + private Func? _latencyUpdate; + private readonly object _latencyUpdateLock = new(); - private readonly object _resumeLock = new(); - private Func? _resume; public event Func? Resume { add @@ -372,9 +356,9 @@ public event Func? Resume UnhookEvent(_resumeLock, value, ref _resume, (c, e) => c.Resume -= e); } } + private Func? _resume; + private readonly object _resumeLock = new(); - private readonly object _connectingLock = new(); - private Func? _connecting; public event Func? Connecting { add @@ -386,9 +370,9 @@ public event Func? Connecting UnhookEvent(_connectingLock, value, ref _connecting, (c, e) => c.Connecting -= e); } } + private Func? _connecting; + private readonly object _connectingLock = new(); - private readonly object _connectLock = new(); - private Func? _connect; public event Func? Connect { add @@ -400,9 +384,9 @@ public event Func? Connect UnhookEvent(_connectLock, value, ref _connect, (c, e) => c.Connect -= e); } } + private Func? _connect; + private readonly object _connectLock = new(); - private readonly object _disconnectLock = new(); - private Func? _disconnect; public event Func? Disconnect { add @@ -414,9 +398,9 @@ public event Func? Disconnect UnhookEvent(_disconnectLock, value, ref _disconnect, (c, e) => c.Disconnect -= e); } } + private Func? _disconnect; + private readonly object _disconnectLock = new(); - private readonly object _closeLock = new(); - private Func? _close; public event Func? Close { add @@ -428,9 +412,9 @@ public event Func? Close UnhookEvent(_closeLock, value, ref _close, (c, e) => c.Close -= e); } } + private Func? _close; + private readonly object _closeLock = new(); - private readonly object _logLock = new(); - private Func? _log; public event Func? Log { add @@ -442,9 +426,27 @@ public event Func? Log UnhookEvent(_logLock, value, ref _log, (c, e) => c.Log -= e); } } + private Func? _log; + private readonly object _logLock = new(); - private readonly object _applicationCommandPermissionsUpdateLock = new(); - private Func? _applicationCommandPermissionsUpdate; + #region Events + + /// + public event Func? Ready + { + add + { + HookEvent(_readyLock, value, ref _ready, client => a => _ready!(client, a), (c, e) => c.Ready += e); + } + remove + { + UnhookEvent(_readyLock, value, ref _ready, (c, e) => c.Ready -= e); + } + } + private Func? _ready; + private readonly object _readyLock = new(); + + /// public event Func? ApplicationCommandPermissionsUpdate { add @@ -456,9 +458,10 @@ public event Func? Appli UnhookEvent(_applicationCommandPermissionsUpdateLock, value, ref _applicationCommandPermissionsUpdate, (c, e) => c.ApplicationCommandPermissionsUpdate -= e); } } + private Func? _applicationCommandPermissionsUpdate; + private readonly object _applicationCommandPermissionsUpdateLock = new(); - private readonly object _autoModerationRuleCreateLock = new(); - private Func? _autoModerationRuleCreate; + /// public event Func? AutoModerationRuleCreate { add @@ -470,9 +473,10 @@ public event Func? AutoModerationR UnhookEvent(_autoModerationRuleCreateLock, value, ref _autoModerationRuleCreate, (c, e) => c.AutoModerationRuleCreate -= e); } } + private Func? _autoModerationRuleCreate; + private readonly object _autoModerationRuleCreateLock = new(); - private readonly object _autoModerationRuleUpdateLock = new(); - private Func? _autoModerationRuleUpdate; + /// public event Func? AutoModerationRuleUpdate { add @@ -484,9 +488,10 @@ public event Func? AutoModerationR UnhookEvent(_autoModerationRuleUpdateLock, value, ref _autoModerationRuleUpdate, (c, e) => c.AutoModerationRuleUpdate -= e); } } + private Func? _autoModerationRuleUpdate; + private readonly object _autoModerationRuleUpdateLock = new(); - private readonly object _autoModerationRuleDeleteLock = new(); - private Func? _autoModerationRuleDelete; + /// public event Func? AutoModerationRuleDelete { add @@ -498,9 +503,10 @@ public event Func? AutoModerationR UnhookEvent(_autoModerationRuleDeleteLock, value, ref _autoModerationRuleDelete, (c, e) => c.AutoModerationRuleDelete -= e); } } + private Func? _autoModerationRuleDelete; + private readonly object _autoModerationRuleDeleteLock = new(); - private readonly object _autoModerationActionExecutionLock = new(); - private Func? _autoModerationActionExecution; + /// public event Func? AutoModerationActionExecution { add @@ -512,9 +518,10 @@ public event Func c.AutoModerationActionExecution -= e); } } + private Func? _autoModerationActionExecution; + private readonly object _autoModerationActionExecutionLock = new(); - private readonly object _guildChannelCreateLock = new(); - private Func? _guildChannelCreate; + /// public event Func? GuildChannelCreate { add @@ -526,9 +533,10 @@ public event Func? GuildChannelCreate UnhookEvent(_guildChannelCreateLock, value, ref _guildChannelCreate, (c, e) => c.GuildChannelCreate -= e); } } + private Func? _guildChannelCreate; + private readonly object _guildChannelCreateLock = new(); - private readonly object _guildChannelUpdateLock = new(); - private Func? _guildChannelUpdate; + /// public event Func? GuildChannelUpdate { add @@ -540,9 +548,10 @@ public event Func? GuildChannelUpdate UnhookEvent(_guildChannelUpdateLock, value, ref _guildChannelUpdate, (c, e) => c.GuildChannelUpdate -= e); } } + private Func? _guildChannelUpdate; + private readonly object _guildChannelUpdateLock = new(); - private readonly object _guildChannelDeleteLock = new(); - private Func? _guildChannelDelete; + /// public event Func? GuildChannelDelete { add @@ -554,9 +563,10 @@ public event Func? GuildChannelDelete UnhookEvent(_guildChannelDeleteLock, value, ref _guildChannelDelete, (c, e) => c.GuildChannelDelete -= e); } } + private Func? _guildChannelDelete; + private readonly object _guildChannelDeleteLock = new(); - private readonly object _channelPinsUpdateLock = new(); - private Func? _channelPinsUpdate; + /// public event Func? ChannelPinsUpdate { add @@ -568,9 +578,10 @@ public event Func? Channel UnhookEvent(_channelPinsUpdateLock, value, ref _channelPinsUpdate, (c, e) => c.ChannelPinsUpdate -= e); } } + private Func? _channelPinsUpdate; + private readonly object _channelPinsUpdateLock = new(); - private readonly object _guildThreadCreateLock = new(); - private Func? _guildThreadCreate; + /// public event Func? GuildThreadCreate { add @@ -582,9 +593,10 @@ public event Func? GuildTh UnhookEvent(_guildThreadCreateLock, value, ref _guildThreadCreate, (c, e) => c.GuildThreadCreate -= e); } } + private Func? _guildThreadCreate; + private readonly object _guildThreadCreateLock = new(); - private readonly object _guildThreadUpdateLock = new(); - private Func? _guildThreadUpdate; + /// public event Func? GuildThreadUpdate { add @@ -596,9 +608,10 @@ public event Func? GuildThreadUpdate UnhookEvent(_guildThreadUpdateLock, value, ref _guildThreadUpdate, (c, e) => c.GuildThreadUpdate -= e); } } + private Func? _guildThreadUpdate; + private readonly object _guildThreadUpdateLock = new(); - private readonly object _guildThreadDeleteLock = new(); - private Func? _guildThreadDelete; + /// public event Func? GuildThreadDelete { add @@ -610,9 +623,10 @@ public event Func? GuildTh UnhookEvent(_guildThreadDeleteLock, value, ref _guildThreadDelete, (c, e) => c.GuildThreadDelete -= e); } } + private Func? _guildThreadDelete; + private readonly object _guildThreadDeleteLock = new(); - private readonly object _guildThreadListSyncLock = new(); - private Func? _guildThreadListSync; + /// public event Func? GuildThreadListSync { add @@ -624,9 +638,10 @@ public event Func? Guild UnhookEvent(_guildThreadListSyncLock, value, ref _guildThreadListSync, (c, e) => c.GuildThreadListSync -= e); } } + private Func? _guildThreadListSync; + private readonly object _guildThreadListSyncLock = new(); - private readonly object _guildThreadUserUpdateLock = new(); - private Func? _guildThreadUserUpdate; + /// public event Func? GuildThreadUserUpdate { add @@ -638,9 +653,10 @@ public event Func? Gui UnhookEvent(_guildThreadUserUpdateLock, value, ref _guildThreadUserUpdate, (c, e) => c.GuildThreadUserUpdate -= e); } } + private Func? _guildThreadUserUpdate; + private readonly object _guildThreadUserUpdateLock = new(); - private readonly object _guildThreadUsersUpdateLock = new(); - private Func? _guildThreadUsersUpdate; + /// public event Func? GuildThreadUsersUpdate { add @@ -652,9 +668,10 @@ public event Func? Gu UnhookEvent(_guildThreadUsersUpdateLock, value, ref _guildThreadUsersUpdate, (c, e) => c.GuildThreadUsersUpdate -= e); } } + private Func? _guildThreadUsersUpdate; + private readonly object _guildThreadUsersUpdateLock = new(); - private readonly object _guildCreateLock = new(); - private Func? _guildCreate; + /// public event Func? GuildCreate { add @@ -666,9 +683,10 @@ public event Func? GuildCreate UnhookEvent(_guildCreateLock, value, ref _guildCreate, (c, e) => c.GuildCreate -= e); } } + private Func? _guildCreate; + private readonly object _guildCreateLock = new(); - private readonly object _guildUpdateLock = new(); - private Func? _guildUpdate; + /// public event Func? GuildUpdate { add @@ -680,9 +698,10 @@ public event Func? GuildUpdate UnhookEvent(_guildUpdateLock, value, ref _guildUpdate, (c, e) => c.GuildUpdate -= e); } } + private Func? _guildUpdate; + private readonly object _guildUpdateLock = new(); - private readonly object _guildDeleteLock = new(); - private Func? _guildDelete; + /// public event Func? GuildDelete { add @@ -694,9 +713,10 @@ public event Func? GuildDelete UnhookEvent(_guildDeleteLock, value, ref _guildDelete, (c, e) => c.GuildDelete -= e); } } + private Func? _guildDelete; + private readonly object _guildDeleteLock = new(); - private readonly object _guildAuditLogEntryCreateLock = new(); - private Func? _guildAuditLogEntryCreate; + /// public event Func? GuildAuditLogEntryCreate { add @@ -708,9 +728,10 @@ public event Func? GuildAuditLogEntryCr UnhookEvent(_guildAuditLogEntryCreateLock, value, ref _guildAuditLogEntryCreate, (c, e) => c.GuildAuditLogEntryCreate -= e); } } + private Func? _guildAuditLogEntryCreate; + private readonly object _guildAuditLogEntryCreateLock = new(); - private readonly object _guildBanAddLock = new(); - private Func? _guildBanAdd; + /// public event Func? GuildBanAdd { add @@ -722,9 +743,10 @@ public event Func? GuildBanAdd UnhookEvent(_guildBanAddLock, value, ref _guildBanAdd, (c, e) => c.GuildBanAdd -= e); } } + private Func? _guildBanAdd; + private readonly object _guildBanAddLock = new(); - private readonly object _guildBanRemoveLock = new(); - private Func? _guildBanRemove; + /// public event Func? GuildBanRemove { add @@ -736,9 +758,10 @@ public event Func? GuildBanRemove UnhookEvent(_guildBanRemoveLock, value, ref _guildBanRemove, (c, e) => c.GuildBanRemove -= e); } } + private Func? _guildBanRemove; + private readonly object _guildBanRemoveLock = new(); - private readonly object _guildEmojisUpdateLock = new(); - private Func? _guildEmojisUpdate; + /// public event Func? GuildEmojisUpdate { add @@ -750,9 +773,10 @@ public event Func? GuildEm UnhookEvent(_guildEmojisUpdateLock, value, ref _guildEmojisUpdate, (c, e) => c.GuildEmojisUpdate -= e); } } + private Func? _guildEmojisUpdate; + private readonly object _guildEmojisUpdateLock = new(); - private readonly object _guildStickersUpdateLock = new(); - private Func? _guildStickersUpdate; + /// public event Func? GuildStickersUpdate { add @@ -764,9 +788,10 @@ public event Func? Guild UnhookEvent(_guildStickersUpdateLock, value, ref _guildStickersUpdate, (c, e) => c.GuildStickersUpdate -= e); } } + private Func? _guildStickersUpdate; + private readonly object _guildStickersUpdateLock = new(); - private readonly object _guildIntegrationsUpdateLock = new(); - private Func? _guildIntegrationsUpdate; + /// public event Func? GuildIntegrationsUpdate { add @@ -778,9 +803,10 @@ public event Func? G UnhookEvent(_guildIntegrationsUpdateLock, value, ref _guildIntegrationsUpdate, (c, e) => c.GuildIntegrationsUpdate -= e); } } + private Func? _guildIntegrationsUpdate; + private readonly object _guildIntegrationsUpdateLock = new(); - private readonly object _guildUserAddLock = new(); - private Func? _guildUserAdd; + /// public event Func? GuildUserAdd { add @@ -792,9 +818,10 @@ public event Func? GuildUserAdd UnhookEvent(_guildUserAddLock, value, ref _guildUserAdd, (c, e) => c.GuildUserAdd -= e); } } + private Func? _guildUserAdd; + private readonly object _guildUserAddLock = new(); - private readonly object _guildUserUpdateLock = new(); - private Func? _guildUserUpdate; + /// public event Func? GuildUserUpdate { add @@ -806,9 +833,10 @@ public event Func? GuildUserUpdate UnhookEvent(_guildUserUpdateLock, value, ref _guildUserUpdate, (c, e) => c.GuildUserUpdate -= e); } } + private Func? _guildUserUpdate; + private readonly object _guildUserUpdateLock = new(); - private readonly object _guildUserRemoveLock = new(); - private Func? _guildUserRemove; + /// public event Func? GuildUserRemove { add @@ -820,9 +848,10 @@ public event Func? GuildUser UnhookEvent(_guildUserRemoveLock, value, ref _guildUserRemove, (c, e) => c.GuildUserRemove -= e); } } + private Func? _guildUserRemove; + private readonly object _guildUserRemoveLock = new(); - private readonly object _guildUserChunkLock = new(); - private Func? _guildUserChunk; + /// public event Func? GuildUserChunk { add @@ -834,9 +863,10 @@ public event Func? GuildUserC UnhookEvent(_guildUserChunkLock, value, ref _guildUserChunk, (c, e) => c.GuildUserChunk -= e); } } + private Func? _guildUserChunk; + private readonly object _guildUserChunkLock = new(); - private readonly object _roleCreateLock = new(); - private Func? _roleCreate; + /// public event Func? RoleCreate { add @@ -848,9 +878,10 @@ public event Func? RoleCreate UnhookEvent(_roleCreateLock, value, ref _roleCreate, (c, e) => c.RoleCreate -= e); } } + private Func? _roleCreate; + private readonly object _roleCreateLock = new(); - private readonly object _roleUpdateLock = new(); - private Func? _roleUpdate; + /// public event Func? RoleUpdate { add @@ -862,9 +893,10 @@ public event Func? RoleUpdate UnhookEvent(_roleUpdateLock, value, ref _roleUpdate, (c, e) => c.RoleUpdate -= e); } } + private Func? _roleUpdate; + private readonly object _roleUpdateLock = new(); - private readonly object _roleDeleteLock = new(); - private Func? _roleDelete; + /// public event Func? RoleDelete { add @@ -876,9 +908,10 @@ public event Func? RoleDelete UnhookEvent(_roleDeleteLock, value, ref _roleDelete, (c, e) => c.RoleDelete -= e); } } + private Func? _roleDelete; + private readonly object _roleDeleteLock = new(); - private readonly object _guildScheduledEventCreateLock = new(); - private Func? _guildScheduledEventCreate; + /// public event Func? GuildScheduledEventCreate { add @@ -890,9 +923,10 @@ public event Func? GuildScheduled UnhookEvent(_guildScheduledEventCreateLock, value, ref _guildScheduledEventCreate, (c, e) => c.GuildScheduledEventCreate -= e); } } + private Func? _guildScheduledEventCreate; + private readonly object _guildScheduledEventCreateLock = new(); - private readonly object _guildScheduledEventUpdateLock = new(); - private Func? _guildScheduledEventUpdate; + /// public event Func? GuildScheduledEventUpdate { add @@ -904,9 +938,10 @@ public event Func? GuildScheduled UnhookEvent(_guildScheduledEventUpdateLock, value, ref _guildScheduledEventUpdate, (c, e) => c.GuildScheduledEventUpdate -= e); } } + private Func? _guildScheduledEventUpdate; + private readonly object _guildScheduledEventUpdateLock = new(); - private readonly object _guildScheduledEventDeleteLock = new(); - private Func? _guildScheduledEventDelete; + /// public event Func? GuildScheduledEventDelete { add @@ -918,9 +953,10 @@ public event Func? GuildScheduled UnhookEvent(_guildScheduledEventDeleteLock, value, ref _guildScheduledEventDelete, (c, e) => c.GuildScheduledEventDelete -= e); } } + private Func? _guildScheduledEventDelete; + private readonly object _guildScheduledEventDeleteLock = new(); - private readonly object _guildScheduledEventUserAddLock = new(); - private Func? _guildScheduledEventUserAdd; + /// public event Func? GuildScheduledEventUserAdd { add @@ -932,9 +968,10 @@ public event Func? G UnhookEvent(_guildScheduledEventUserAddLock, value, ref _guildScheduledEventUserAdd, (c, e) => c.GuildScheduledEventUserAdd -= e); } } + private Func? _guildScheduledEventUserAdd; + private readonly object _guildScheduledEventUserAddLock = new(); - private readonly object _guildScheduledEventUserRemoveLock = new(); - private Func? _guildScheduledEventUserRemove; + /// public event Func? GuildScheduledEventUserRemove { add @@ -946,9 +983,10 @@ public event Func? G UnhookEvent(_guildScheduledEventUserRemoveLock, value, ref _guildScheduledEventUserRemove, (c, e) => c.GuildScheduledEventUserRemove -= e); } } + private Func? _guildScheduledEventUserRemove; + private readonly object _guildScheduledEventUserRemoveLock = new(); - private readonly object _guildIntegrationCreateLock = new(); - private Func? _guildIntegrationCreate; + /// public event Func? GuildIntegrationCreate { add @@ -960,9 +998,10 @@ public event Func? GuildInt UnhookEvent(_guildIntegrationCreateLock, value, ref _guildIntegrationCreate, (c, e) => c.GuildIntegrationCreate -= e); } } + private Func? _guildIntegrationCreate; + private readonly object _guildIntegrationCreateLock = new(); - private readonly object _guildIntegrationUpdateLock = new(); - private Func? _guildIntegrationUpdate; + /// public event Func? GuildIntegrationUpdate { add @@ -974,9 +1013,10 @@ public event Func? GuildInt UnhookEvent(_guildIntegrationUpdateLock, value, ref _guildIntegrationUpdate, (c, e) => c.GuildIntegrationUpdate -= e); } } + private Func? _guildIntegrationUpdate; + private readonly object _guildIntegrationUpdateLock = new(); - private readonly object _guildIntegrationDeleteLock = new(); - private Func? _guildIntegrationDelete; + /// public event Func? GuildIntegrationDelete { add @@ -988,9 +1028,10 @@ public event Func? Gu UnhookEvent(_guildIntegrationDeleteLock, value, ref _guildIntegrationDelete, (c, e) => c.GuildIntegrationDelete -= e); } } + private Func? _guildIntegrationDelete; + private readonly object _guildIntegrationDeleteLock = new(); - private readonly object _guildInviteCreateLock = new(); - private Func? _guildInviteCreate; + /// public event Func? GuildInviteCreate { add @@ -1002,9 +1043,10 @@ public event Func? GuildInviteCreate UnhookEvent(_guildInviteCreateLock, value, ref _guildInviteCreate, (c, e) => c.GuildInviteCreate -= e); } } + private Func? _guildInviteCreate; + private readonly object _guildInviteCreateLock = new(); - private readonly object _guildInviteDeleteLock = new(); - private Func? _guildInviteDelete; + /// public event Func? GuildInviteDelete { add @@ -1016,9 +1058,10 @@ public event Func? GuildIn UnhookEvent(_guildInviteDeleteLock, value, ref _guildInviteDelete, (c, e) => c.GuildInviteDelete -= e); } } + private Func? _guildInviteDelete; + private readonly object _guildInviteDeleteLock = new(); - private readonly object _messageCreateLock = new(); - private Func? _messageCreate; + /// public event Func? MessageCreate { add @@ -1030,9 +1073,10 @@ public event Func? MessageCreate UnhookEvent(_messageCreateLock, value, ref _messageCreate, (c, e) => c.MessageCreate -= e); } } + private Func? _messageCreate; + private readonly object _messageCreateLock = new(); - private readonly object _messageUpdateLock = new(); - private Func? _messageUpdate; + /// public event Func? MessageUpdate { add @@ -1044,9 +1088,10 @@ public event Func? MessageUpdate UnhookEvent(_messageUpdateLock, value, ref _messageUpdate, (c, e) => c.MessageUpdate -= e); } } + private Func? _messageUpdate; + private readonly object _messageUpdateLock = new(); - private readonly object _messageDeleteLock = new(); - private Func? _messageDelete; + /// public event Func? MessageDelete { add @@ -1058,9 +1103,10 @@ public event Func? MessageDele UnhookEvent(_messageDeleteLock, value, ref _messageDelete, (c, e) => c.MessageDelete -= e); } } + private Func? _messageDelete; + private readonly object _messageDeleteLock = new(); - private readonly object _messageDeleteBulkLock = new(); - private Func? _messageDeleteBulk; + /// public event Func? MessageDeleteBulk { add @@ -1072,9 +1118,10 @@ public event Func? Message UnhookEvent(_messageDeleteBulkLock, value, ref _messageDeleteBulk, (c, e) => c.MessageDeleteBulk -= e); } } + private Func? _messageDeleteBulk; + private readonly object _messageDeleteBulkLock = new(); - private readonly object _messageReactionAddLock = new(); - private Func? _messageReactionAdd; + /// public event Func? MessageReactionAdd { add @@ -1086,9 +1133,10 @@ public event Func? Messag UnhookEvent(_messageReactionAddLock, value, ref _messageReactionAdd, (c, e) => c.MessageReactionAdd -= e); } } + private Func? _messageReactionAdd; + private readonly object _messageReactionAddLock = new(); - private readonly object _messageReactionRemoveLock = new(); - private Func? _messageReactionRemove; + /// public event Func? MessageReactionRemove { add @@ -1100,9 +1148,10 @@ public event Func? Mes UnhookEvent(_messageReactionRemoveLock, value, ref _messageReactionRemove, (c, e) => c.MessageReactionRemove -= e); } } + private Func? _messageReactionRemove; + private readonly object _messageReactionRemoveLock = new(); - private readonly object _messageReactionRemoveAllLock = new(); - private Func? _messageReactionRemoveAll; + /// public event Func? MessageReactionRemoveAll { add @@ -1114,9 +1163,10 @@ public event Func? UnhookEvent(_messageReactionRemoveAllLock, value, ref _messageReactionRemoveAll, (c, e) => c.MessageReactionRemoveAll -= e); } } + private Func? _messageReactionRemoveAll; + private readonly object _messageReactionRemoveAllLock = new(); - private readonly object _messageReactionRemoveEmojiLock = new(); - private Func? _messageReactionRemoveEmoji; + /// public event Func? MessageReactionRemoveEmoji { add @@ -1128,9 +1178,10 @@ public event Func UnhookEvent(_messageReactionRemoveEmojiLock, value, ref _messageReactionRemoveEmoji, (c, e) => c.MessageReactionRemoveEmoji -= e); } } + private Func? _messageReactionRemoveEmoji; + private readonly object _messageReactionRemoveEmojiLock = new(); - private readonly object _presenceUpdateLock = new(); - private Func? _presenceUpdate; + /// public event Func? PresenceUpdate { add @@ -1142,9 +1193,10 @@ public event Func? PresenceUpdate UnhookEvent(_presenceUpdateLock, value, ref _presenceUpdate, (c, e) => c.PresenceUpdate -= e); } } + private Func? _presenceUpdate; + private readonly object _presenceUpdateLock = new(); - private readonly object _typingStartLock = new(); - private Func? _typingStart; + /// public event Func? TypingStart { add @@ -1156,9 +1208,10 @@ public event Func? TypingStart UnhookEvent(_typingStartLock, value, ref _typingStart, (c, e) => c.TypingStart -= e); } } + private Func? _typingStart; + private readonly object _typingStartLock = new(); - private readonly object _currentUserUpdateLock = new(); - private Func? _currentUserUpdate; + /// public event Func? CurrentUserUpdate { add @@ -1170,9 +1223,10 @@ public event Func? CurrentUserUpdate UnhookEvent(_currentUserUpdateLock, value, ref _currentUserUpdate, (c, e) => c.CurrentUserUpdate -= e); } } + private Func? _currentUserUpdate; + private readonly object _currentUserUpdateLock = new(); - private readonly object _voiceStateUpdateLock = new(); - private Func? _voiceStateUpdate; + /// public event Func? VoiceStateUpdate { add @@ -1184,9 +1238,10 @@ public event Func? VoiceStateUpdate UnhookEvent(_voiceStateUpdateLock, value, ref _voiceStateUpdate, (c, e) => c.VoiceStateUpdate -= e); } } + private Func? _voiceStateUpdate; + private readonly object _voiceStateUpdateLock = new(); - private readonly object _voiceServerUpdateLock = new(); - private Func? _voiceServerUpdate; + /// public event Func? VoiceServerUpdate { add @@ -1198,9 +1253,10 @@ public event Func? VoiceSe UnhookEvent(_voiceServerUpdateLock, value, ref _voiceServerUpdate, (c, e) => c.VoiceServerUpdate -= e); } } + private Func? _voiceServerUpdate; + private readonly object _voiceServerUpdateLock = new(); - private readonly object _webhooksUpdateLock = new(); - private Func? _webhooksUpdate; + /// public event Func? WebhooksUpdate { add @@ -1212,9 +1268,10 @@ public event Func? WebhooksUp UnhookEvent(_webhooksUpdateLock, value, ref _webhooksUpdate, (c, e) => c.WebhooksUpdate -= e); } } + private Func? _webhooksUpdate; + private readonly object _webhooksUpdateLock = new(); - private readonly object _interactionCreateLock = new(); - private Func? _interactionCreate; + /// public event Func? InteractionCreate { add @@ -1226,9 +1283,10 @@ public event Func? InteractionCreate UnhookEvent(_interactionCreateLock, value, ref _interactionCreate, (c, e) => c.InteractionCreate -= e); } } + private Func? _interactionCreate; + private readonly object _interactionCreateLock = new(); - private readonly object _stageInstanceCreateLock = new(); - private Func? _stageInstanceCreate; + /// public event Func? StageInstanceCreate { add @@ -1240,9 +1298,10 @@ public event Func? StageInstanceCreate UnhookEvent(_stageInstanceCreateLock, value, ref _stageInstanceCreate, (c, e) => c.StageInstanceCreate -= e); } } + private Func? _stageInstanceCreate; + private readonly object _stageInstanceCreateLock = new(); - private readonly object _stageInstanceUpdateLock = new(); - private Func? _stageInstanceUpdate; + /// public event Func? StageInstanceUpdate { add @@ -1254,9 +1313,10 @@ public event Func? StageInstanceUpdate UnhookEvent(_stageInstanceUpdateLock, value, ref _stageInstanceUpdate, (c, e) => c.StageInstanceUpdate -= e); } } + private Func? _stageInstanceUpdate; + private readonly object _stageInstanceUpdateLock = new(); - private readonly object _stageInstanceDeleteLock = new(); - private Func? _stageInstanceDelete; + /// public event Func? StageInstanceDelete { add @@ -1268,9 +1328,10 @@ public event Func? StageInstanceDelete UnhookEvent(_stageInstanceDeleteLock, value, ref _stageInstanceDelete, (c, e) => c.StageInstanceDelete -= e); } } + private Func? _stageInstanceDelete; + private readonly object _stageInstanceDeleteLock = new(); - private readonly object _entitlementCreateLock = new(); - private Func? _entitlementCreate; + /// public event Func? EntitlementCreate { add @@ -1282,9 +1343,10 @@ public event Func? EntitlementCreate UnhookEvent(_entitlementCreateLock, value, ref _entitlementCreate, (c, e) => c.EntitlementCreate -= e); } } + private Func? _entitlementCreate; + private readonly object _entitlementCreateLock = new(); - private readonly object _entitlementUpdateLock = new(); - private Func? _entitlementUpdate; + /// public event Func? EntitlementUpdate { add @@ -1296,9 +1358,10 @@ public event Func? EntitlementUpdate UnhookEvent(_entitlementUpdateLock, value, ref _entitlementUpdate, (c, e) => c.EntitlementUpdate -= e); } } + private Func? _entitlementUpdate; + private readonly object _entitlementUpdateLock = new(); - private readonly object _entitlementDeleteLock = new(); - private Func? _entitlementDelete; + /// public event Func? EntitlementDelete { add @@ -1310,9 +1373,10 @@ public event Func? EntitlementDelete UnhookEvent(_entitlementDeleteLock, value, ref _entitlementDelete, (c, e) => c.EntitlementDelete -= e); } } + private Func? _entitlementDelete; + private readonly object _entitlementDeleteLock = new(); - private readonly object _guildJoinRequestUpdateLock = new(); - private Func? _guildJoinRequestUpdate; + /// public event Func? GuildJoinRequestUpdate { add @@ -1324,9 +1388,10 @@ public event Func? Gu UnhookEvent(_guildJoinRequestUpdateLock, value, ref _guildJoinRequestUpdate, (c, e) => c.GuildJoinRequestUpdate -= e); } } + private Func? _guildJoinRequestUpdate; + private readonly object _guildJoinRequestUpdateLock = new(); - private readonly object _guildJoinRequestDeleteLock = new(); - private Func? _guildJoinRequestDelete; + /// public event Func? GuildJoinRequestDelete { add @@ -1338,9 +1403,10 @@ public event Func? Gu UnhookEvent(_guildJoinRequestDeleteLock, value, ref _guildJoinRequestDelete, (c, e) => c.GuildJoinRequestDelete -= e); } } + private Func? _guildJoinRequestDelete; + private readonly object _guildJoinRequestDeleteLock = new(); - private readonly object _unknownEventLock = new(); - private Func? _unknownEvent; + /// public event Func? UnknownEvent { add @@ -1352,6 +1418,10 @@ public event Func? UnknownEvent UnhookEvent(_unknownEventLock, value, ref _unknownEvent, (c, e) => c.UnknownEvent -= e); } } + private Func? _unknownEvent; + private readonly object _unknownEventLock = new(); + + #endregion private void HookEvent(GatewayClient client, object @lock, ref Func? eventRef, Func @delegate, Action> addGatewayClientEvent) {