diff --git a/DisCatSharp/Clients/DiscordClient.Events.cs b/DisCatSharp/Clients/DiscordClient.Events.cs
index d93bc27ef..2931b39d4 100644
--- a/DisCatSharp/Clients/DiscordClient.Events.cs
+++ b/DisCatSharp/Clients/DiscordClient.Events.cs
@@ -1,977 +1,977 @@
// This file is part of the DisCatSharp project.
//
// Copyright (c) 2021 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using DisCatSharp.EventArgs;
using DisCatSharp.Common.Utilities;
using Microsoft.Extensions.Logging;
namespace DisCatSharp
{
///
/// Represents a discord client.
///
public sealed partial class DiscordClient
{
///
/// Gets the event execution limit.
///
internal static TimeSpan EventExecutionLimit { get; } = TimeSpan.FromSeconds(1);
#region WebSocket
///
/// Fired whenever a WebSocket error occurs within the client.
///
public event AsyncEventHandler SocketErrored
{
add => this._socketErrored.Register(value);
remove => this._socketErrored.Unregister(value);
}
private AsyncEvent _socketErrored;
///
/// Fired whenever WebSocket connection is established.
///
public event AsyncEventHandler SocketOpened
{
add => this._socketOpened.Register(value);
remove => this._socketOpened.Unregister(value);
}
private AsyncEvent _socketOpened;
///
/// Fired whenever WebSocket connection is terminated.
///
public event AsyncEventHandler SocketClosed
{
add => this._socketClosed.Register(value);
remove => this._socketClosed.Unregister(value);
}
private AsyncEvent _socketClosed;
///
/// Fired when the client enters ready state.
///
public event AsyncEventHandler Ready
{
add => this._ready.Register(value);
remove => this._ready.Unregister(value);
}
private AsyncEvent _ready;
///
/// Fired whenever a session is resumed.
///
public event AsyncEventHandler Resumed
{
add => this._resumed.Register(value);
remove => this._resumed.Unregister(value);
}
private AsyncEvent _resumed;
///
/// Fired on received heartbeat ACK.
///
public event AsyncEventHandler Heartbeated
{
add => this._heartbeated.Register(value);
remove => this._heartbeated.Unregister(value);
}
private AsyncEvent _heartbeated;
#endregion
#region Channel
///
/// Fired when a new channel is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ChannelCreated
{
add => this._channelCreated.Register(value);
remove => this._channelCreated.Unregister(value);
}
private AsyncEvent _channelCreated;
///
/// Fired when a channel is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ChannelUpdated
{
add => this._channelUpdated.Register(value);
remove => this._channelUpdated.Unregister(value);
}
private AsyncEvent _channelUpdated;
///
/// Fired when a channel is deleted
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ChannelDeleted
{
add => this._channelDeleted.Register(value);
remove => this._channelDeleted.Unregister(value);
}
private AsyncEvent _channelDeleted;
///
/// Fired when a dm channel is deleted
/// For this Event you need the intent specified in
///
public event AsyncEventHandler DmChannelDeleted
{
add => this._dmChannelDeleted.Register(value);
remove => this._dmChannelDeleted.Unregister(value);
}
private AsyncEvent _dmChannelDeleted;
///
/// Fired whenever a channel's pinned message list is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ChannelPinsUpdated
{
add => this._channelPinsUpdated.Register(value);
remove => this._channelPinsUpdated.Unregister(value);
}
private AsyncEvent _channelPinsUpdated;
#endregion
#region Guild
///
/// Fired when the user joins a new guild.
/// For this Event you need the intent specified in
///
/// [alias="GuildJoined"][alias="JoinedGuild"]
public event AsyncEventHandler GuildCreated
{
add => this._guildCreated.Register(value);
remove => this._guildCreated.Unregister(value);
}
private AsyncEvent _guildCreated;
///
/// Fired when a guild is becoming available.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildAvailable
{
add => this._guildAvailable.Register(value);
remove => this._guildAvailable.Unregister(value);
}
private AsyncEvent _guildAvailable;
///
/// Fired when a guild is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildUpdated
{
add => this._guildUpdated.Register(value);
remove => this._guildUpdated.Unregister(value);
}
private AsyncEvent _guildUpdated;
///
/// Fired when the user leaves or is removed from a guild.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildDeleted
{
add => this._guildDeleted.Register(value);
remove => this._guildDeleted.Unregister(value);
}
private AsyncEvent _guildDeleted;
///
/// Fired when a guild becomes unavailable.
///
public event AsyncEventHandler GuildUnavailable
{
add => this._guildUnavailable.Register(value);
remove => this._guildUnavailable.Unregister(value);
}
private AsyncEvent _guildUnavailable;
///
/// Fired when all guilds finish streaming from Discord.
///
public event AsyncEventHandler GuildDownloadCompleted
{
add => this._guildDownloadCompletedEv.Register(value);
remove => this._guildDownloadCompletedEv.Unregister(value);
}
private AsyncEvent _guildDownloadCompletedEv;
///
/// Fired when a guilds emojis get updated
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildEmojisUpdated
{
add => this._guildEmojisUpdated.Register(value);
remove => this._guildEmojisUpdated.Unregister(value);
}
private AsyncEvent _guildEmojisUpdated;
///
/// Fired when a guilds stickers get updated
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildStickersUpdated
{
add => this._guildStickersUpdated.Register(value);
remove => this._guildStickersUpdated.Unregister(value);
}
private AsyncEvent _guildStickersUpdated;
///
/// Fired when a guild integration is updated.
///
public event AsyncEventHandler GuildIntegrationsUpdated
{
add => this._guildIntegrationsUpdated.Register(value);
remove => this._guildIntegrationsUpdated.Unregister(value);
}
private AsyncEvent _guildIntegrationsUpdated;
#endregion
#region Guild Ban
///
/// Fired when a guild ban gets added
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildBanAdded
{
add => this._guildBanAdded.Register(value);
remove => this._guildBanAdded.Unregister(value);
}
private AsyncEvent _guildBanAdded;
///
/// Fired when a guild ban gets removed
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildBanRemoved
{
add => this._guildBanRemoved.Register(value);
remove => this._guildBanRemoved.Unregister(value);
}
private AsyncEvent _guildBanRemoved;
#endregion
#region Guild Scheduled Event
///
/// Fired when a scheduled Event is created.
- /// For this Event you need the intent specified in
+ /// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventCreated
{
add => this._guildScheduledEventCreated.Register(value);
remove => this._guildScheduledEventCreated.Unregister(value);
}
private AsyncEvent _guildScheduledEventCreated;
///
/// Fired when a scheduled Event is updated.
- /// For this Event you need the intent specified in
+ /// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventUpdated
{
add => this._guildScheduledEventUpdated.Register(value);
remove => this._guildScheduledEventUpdated.Unregister(value);
}
private AsyncEvent _guildScheduledEventUpdated;
///
/// Fired when a scheduled Event is deleted.
- /// For this Event you need the intent specified in
+ /// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventDeleted
{
add => this._guildScheduledEventDeleted.Register(value);
remove => this._guildScheduledEventDeleted.Unregister(value);
}
private AsyncEvent _guildScheduledEventDeleted;
///
/// Fired when a user subscribes to a scheduled event.
- /// For this Event you need the intent specified in
+ /// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventUserAdded
{
add => this._guildScheduledEventUserAdded.Register(value);
remove => this._guildScheduledEventUserAdded.Unregister(value);
}
private AsyncEvent _guildScheduledEventUserAdded;
///
/// Fired when a user unsubscribes from a scheduled event.
- /// For this Event you need the intent specified in
+ /// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventUserRemoved
{
add => this._guildScheduledEventUserRemoved.Register(value);
remove => this._guildScheduledEventUserRemoved.Unregister(value);
}
private AsyncEvent _guildScheduledEventUserRemoved;
#endregion
#region Guild Integration
///
/// Fired when a guild integration is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildIntegrationCreated
{
add => this._guildIntegrationCreated.Register(value);
remove => this._guildIntegrationCreated.Unregister(value);
}
private AsyncEvent _guildIntegrationCreated;
///
/// Fired when a guild integration is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildIntegrationUpdated
{
add => this._guildIntegrationUpdated.Register(value);
remove => this._guildIntegrationUpdated.Unregister(value);
}
private AsyncEvent _guildIntegrationUpdated;
///
/// Fired when a guild integration is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildIntegrationDeleted
{
add => this._guildIntegrationDeleted.Register(value);
remove => this._guildIntegrationDeleted.Unregister(value);
}
private AsyncEvent _guildIntegrationDeleted;
#endregion
#region Guild Member
///
/// Fired when a new user joins a guild.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildMemberAdded
{
add => this._guildMemberAdded.Register(value);
remove => this._guildMemberAdded.Unregister(value);
}
private AsyncEvent _guildMemberAdded;
///
/// Fired when a user is removed from a guild (leave/kick/ban).
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildMemberRemoved
{
add => this._guildMemberRemoved.Register(value);
remove => this._guildMemberRemoved.Unregister(value);
}
private AsyncEvent _guildMemberRemoved;
///
/// Fired when a guild member is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildMemberUpdated
{
add => this._guildMemberUpdated.Register(value);
remove => this._guildMemberUpdated.Unregister(value);
}
private AsyncEvent _guildMemberUpdated;
///
/// Fired in response to Gateway Request Guild Members.
///
public event AsyncEventHandler GuildMembersChunked
{
add => this._guildMembersChunked.Register(value);
remove => this._guildMembersChunked.Unregister(value);
}
private AsyncEvent _guildMembersChunked;
#endregion
#region Guild Role
///
/// Fired when a guild role is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildRoleCreated
{
add => this._guildRoleCreated.Register(value);
remove => this._guildRoleCreated.Unregister(value);
}
private AsyncEvent _guildRoleCreated;
///
/// Fired when a guild role is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildRoleUpdated
{
add => this._guildRoleUpdated.Register(value);
remove => this._guildRoleUpdated.Unregister(value);
}
private AsyncEvent _guildRoleUpdated;
///
/// Fired when a guild role is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildRoleDeleted
{
add => this._guildRoleDeleted.Register(value);
remove => this._guildRoleDeleted.Unregister(value);
}
private AsyncEvent _guildRoleDeleted;
#endregion
#region Invite
///
/// Fired when an invite is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler InviteCreated
{
add => this._inviteCreated.Register(value);
remove => this._inviteCreated.Unregister(value);
}
private AsyncEvent _inviteCreated;
///
/// Fired when an invite is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler InviteDeleted
{
add => this._inviteDeleted.Register(value);
remove => this._inviteDeleted.Unregister(value);
}
private AsyncEvent _inviteDeleted;
#endregion
#region Message
///
/// Fired when a message is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageCreated
{
add => this._messageCreated.Register(value);
remove => this._messageCreated.Unregister(value);
}
private AsyncEvent _messageCreated;
///
/// Fired when message is acknowledged by the user.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageAcknowledged
{
add => this._messageAcknowledged.Register(value);
remove => this._messageAcknowledged.Unregister(value);
}
private AsyncEvent _messageAcknowledged;
///
/// Fired when a message is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageUpdated
{
add => this._messageUpdated.Register(value);
remove => this._messageUpdated.Unregister(value);
}
private AsyncEvent _messageUpdated;
///
/// Fired when a message is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageDeleted
{
add => this._messageDeleted.Register(value);
remove => this._messageDeleted.Unregister(value);
}
private AsyncEvent _messageDeleted;
///
/// Fired when multiple messages are deleted at once.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessagesBulkDeleted
{
add => this._messagesBulkDeleted.Register(value);
remove => this._messagesBulkDeleted.Unregister(value);
}
private AsyncEvent _messagesBulkDeleted;
#endregion
#region Message Reaction
///
/// Fired when a reaction gets added to a message.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageReactionAdded
{
add => this._messageReactionAdded.Register(value);
remove => this._messageReactionAdded.Unregister(value);
}
private AsyncEvent _messageReactionAdded;
///
/// Fired when a reaction gets removed from a message.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageReactionRemoved
{
add => this._messageReactionRemoved.Register(value);
remove => this._messageReactionRemoved.Unregister(value);
}
private AsyncEvent _messageReactionRemoved;
///
/// Fired when all reactions get removed from a message.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageReactionsCleared
{
add => this._messageReactionsCleared.Register(value);
remove => this._messageReactionsCleared.Unregister(value);
}
private AsyncEvent _messageReactionsCleared;
///
/// Fired when all reactions of a specific reaction are removed from a message.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageReactionRemovedEmoji
{
add => this._messageReactionRemovedEmoji.Register(value);
remove => this._messageReactionRemovedEmoji.Unregister(value);
}
private AsyncEvent _messageReactionRemovedEmoji;
#endregion
#region Activities
///
/// Fired when a embedded activity has been updated.
///
public event AsyncEventHandler EmbeddedActivityUpdated
{
add => this._embeddedActivityUpdated.Register(value);
remove => this._embeddedActivityUpdated.Unregister(value);
}
private AsyncEvent _embeddedActivityUpdated;
#endregion
#region Presence/User Update
///
/// Fired when a presence has been updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler PresenceUpdated
{
add => this._presenceUpdated.Register(value);
remove => this._presenceUpdated.Unregister(value);
}
private AsyncEvent _presenceUpdated;
///
/// Fired when the current user updates their settings.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler UserSettingsUpdated
{
add => this._userSettingsUpdated.Register(value);
remove => this._userSettingsUpdated.Unregister(value);
}
private AsyncEvent _userSettingsUpdated;
///
/// Fired when properties about the current user change.
///
///
/// NB: This event only applies for changes to the current user, the client that is connected to Discord.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler UserUpdated
{
add => this._userUpdated.Register(value);
remove => this._userUpdated.Unregister(value);
}
private AsyncEvent _userUpdated;
#endregion
#region Stage Instance
///
/// Fired when a Stage Instance is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler StageInstanceCreated
{
add => this._stageInstanceCreated.Register(value);
remove => this._stageInstanceCreated.Unregister(value);
}
private AsyncEvent _stageInstanceCreated;
///
/// Fired when a Stage Instance is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler StageInstanceUpdated
{
add => this._stageInstanceUpdated.Register(value);
remove => this._stageInstanceUpdated.Unregister(value);
}
private AsyncEvent _stageInstanceUpdated;
///
/// Fired when a Stage Instance is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler StageInstanceDeleted
{
add => this._stageInstanceDeleted.Register(value);
remove => this._stageInstanceDeleted.Unregister(value);
}
private AsyncEvent _stageInstanceDeleted;
#endregion
#region Thread
///
/// Fired when a thread is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ThreadCreated
{
add => this._threadCreated.Register(value);
remove => this._threadCreated.Unregister(value);
}
private AsyncEvent _threadCreated;
///
/// Fired when a thread is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ThreadUpdated
{
add => this._threadUpdated.Register(value);
remove => this._threadUpdated.Unregister(value);
}
private AsyncEvent _threadUpdated;
///
/// Fired when a thread is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ThreadDeleted
{
add => this._threadDeleted.Register(value);
remove => this._threadDeleted.Unregister(value);
}
private AsyncEvent _threadDeleted;
///
/// Fired when a thread member is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ThreadListSynced
{
add => this._threadListSynced.Register(value);
remove => this._threadListSynced.Unregister(value);
}
private AsyncEvent _threadListSynced;
///
/// Fired when a thread member is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ThreadMemberUpdated
{
add => this._threadMemberUpdated.Register(value);
remove => this._threadMemberUpdated.Unregister(value);
}
private AsyncEvent _threadMemberUpdated;
///
/// Fired when the thread members are updated.
/// For this Event you need the or intent specified in
///
public event AsyncEventHandler ThreadMembersUpdated
{
add => this._threadMembersUpdated.Register(value);
remove => this._threadMembersUpdated.Unregister(value);
}
private AsyncEvent _threadMembersUpdated;
#endregion
#region Voice
///
/// Fired when someone joins/leaves/moves voice channels.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler VoiceStateUpdated
{
add => this._voiceStateUpdated.Register(value);
remove => this._voiceStateUpdated.Unregister(value);
}
private AsyncEvent _voiceStateUpdated;
///
/// Fired when a guild's voice server is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler VoiceServerUpdated
{
add => this._voiceServerUpdated.Register(value);
remove => this._voiceServerUpdated.Unregister(value);
}
private AsyncEvent _voiceServerUpdated;
#endregion
#region Application
///
/// Fired when a new application command is registered.
///
public event AsyncEventHandler ApplicationCommandCreated
{
add => this._applicationCommandCreated.Register(value);
remove => this._applicationCommandCreated.Unregister(value);
}
private AsyncEvent _applicationCommandCreated;
///
/// Fired when an application command is updated.
///
public event AsyncEventHandler ApplicationCommandUpdated
{
add => this._applicationCommandUpdated.Register(value);
remove => this._applicationCommandUpdated.Unregister(value);
}
private AsyncEvent _applicationCommandUpdated;
///
/// Fired when an application command is deleted.
///
public event AsyncEventHandler ApplicationCommandDeleted
{
add => this._applicationCommandDeleted.Register(value);
remove => this._applicationCommandDeleted.Unregister(value);
}
private AsyncEvent _applicationCommandDeleted;
///
/// Fired when a new application command is registered.
///
public event AsyncEventHandler GuildApplicationCommandCountUpdated
{
add => this._guildApplicationCommandCountUpdated.Register(value);
remove => this._guildApplicationCommandCountUpdated.Unregister(value);
}
private AsyncEvent _guildApplicationCommandCountUpdated;
///
/// Fired when a user uses a context menu.
///
public event AsyncEventHandler ContextMenuInteractionCreated
{
add => this._contextMenuInteractionCreated.Register(value);
remove => this._contextMenuInteractionCreated.Unregister(value);
}
private AsyncEvent _contextMenuInteractionCreated;
///
/// Fired when application command permissions gets updated.
///
public event AsyncEventHandler ApplicationCommandPermissionsUpdated
{
add => this._applicationCommandPermissionsUpdated.Register(value);
remove => this._applicationCommandPermissionsUpdated.Unregister(value);
}
private AsyncEvent _applicationCommandPermissionsUpdated;
#endregion
#region Misc
///
/// Fired when an interaction is invoked.
///
public event AsyncEventHandler InteractionCreated
{
add => this._interactionCreated.Register(value);
remove => this._interactionCreated.Unregister(value);
}
private AsyncEvent _interactionCreated;
///
/// Fired when a component is invoked.
///
public event AsyncEventHandler ComponentInteractionCreated
{
add => this._componentInteractionCreated.Register(value);
remove => this._componentInteractionCreated.Unregister(value);
}
private AsyncEvent _componentInteractionCreated;
///
/// Fired when a user starts typing in a channel.
///
public event AsyncEventHandler TypingStarted
{
add => this._typingStarted.Register(value);
remove => this._typingStarted.Unregister(value);
}
private AsyncEvent _typingStarted;
///
/// Fired when an unknown event gets received.
///
public event AsyncEventHandler UnknownEvent
{
add => this._unknownEvent.Register(value);
remove => this._unknownEvent.Unregister(value);
}
private AsyncEvent _unknownEvent;
///
/// Fired whenever webhooks update.
///
public event AsyncEventHandler WebhooksUpdated
{
add => this._webhooksUpdated.Register(value);
remove => this._webhooksUpdated.Unregister(value);
}
private AsyncEvent _webhooksUpdated;
///
/// Fired whenever an error occurs within an event handler.
///
public event AsyncEventHandler ClientErrored
{
add => this._clientErrored.Register(value);
remove => this._clientErrored.Unregister(value);
}
private AsyncEvent _clientErrored;
#endregion
#region Error Handling
///
/// Events the error handler.
///
/// The async event.
/// The ex.
/// The handler.
/// The sender.
/// The event args.
internal void EventErrorHandler(AsyncEvent asyncEvent, Exception ex, AsyncEventHandler handler, TSender sender, TArgs eventArgs)
where TArgs : AsyncEventArgs
{
if (ex is AsyncEventTimeoutException)
{
this.Logger.LogWarning(LoggerEvents.EventHandlerException, $"An event handler for {asyncEvent.Name} took too long to execute. Defined as \"{handler.Method.ToString().Replace(handler.Method.ReturnType.ToString(), "").TrimStart()}\" located in \"{handler.Method.DeclaringType}\".");
return;
}
this.Logger.LogError(LoggerEvents.EventHandlerException, ex, "Event handler exception for event {0} thrown from {1} (defined in {2})", asyncEvent.Name, handler.Method, handler.Method.DeclaringType);
this._clientErrored.InvokeAsync(this, new ClientErrorEventArgs(this.ServiceProvider) { EventName = asyncEvent.Name, Exception = ex }).ConfigureAwait(false).GetAwaiter().GetResult();
}
///
/// Fired on heartbeat attempt cancellation due to too many failed heartbeats.
///
public event AsyncEventHandler Zombied
{
add => this._zombied.Register(value);
remove => this._zombied.Unregister(value);
}
private AsyncEvent _zombied;
///
/// Fired when a gateway
///
public event AsyncEventHandler PayloadReceived
{
add => this._payloadReceived.Register(value);
remove => this._payloadReceived.Unregister(value);
}
private AsyncEvent _payloadReceived;
///
/// Goofing.
///
/// The async event.
/// The ex.
/// The handler.
/// The sender.
/// The event args.
private void Goof(AsyncEvent asyncEvent, Exception ex, AsyncEventHandler handler, TSender sender, TArgs eventArgs)
where TArgs : AsyncEventArgs => this.Logger.LogCritical(LoggerEvents.EventHandlerException, ex, "Exception event handler {0} (defined in {1}) threw an exception", handler.Method, handler.Method.DeclaringType);
#endregion
}
}
diff --git a/DisCatSharp/Clients/DiscordShardedClient.Events.cs b/DisCatSharp/Clients/DiscordShardedClient.Events.cs
index d54cb2daa..bb55fac9a 100644
--- a/DisCatSharp/Clients/DiscordShardedClient.Events.cs
+++ b/DisCatSharp/Clients/DiscordShardedClient.Events.cs
@@ -1,1650 +1,1650 @@
// This file is part of the DisCatSharp project.
//
// Copyright (c) 2021 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Threading.Tasks;
using DisCatSharp.EventArgs;
using DisCatSharp.Common.Utilities;
using Microsoft.Extensions.Logging;
namespace DisCatSharp
{
///
/// Represents a discord sharded client.
///
public sealed partial class DiscordShardedClient
{
#region WebSocket
///
/// Fired whenever a WebSocket error occurs within the client.
///
public event AsyncEventHandler SocketErrored
{
add => this._socketErrored.Register(value);
remove => this._socketErrored.Unregister(value);
}
private AsyncEvent _socketErrored;
///
/// Fired whenever WebSocket connection is established.
///
public event AsyncEventHandler SocketOpened
{
add => this._socketOpened.Register(value);
remove => this._socketOpened.Unregister(value);
}
private AsyncEvent _socketOpened;
///
/// Fired whenever WebSocket connection is terminated.
///
public event AsyncEventHandler SocketClosed
{
add => this._socketClosed.Register(value);
remove => this._socketClosed.Unregister(value);
}
private AsyncEvent _socketClosed;
///
/// Fired when the client enters ready state.
///
public event AsyncEventHandler Ready
{
add => this._ready.Register(value);
remove => this._ready.Unregister(value);
}
private AsyncEvent _ready;
///
/// Fired whenever a session is resumed.
///
public event AsyncEventHandler Resumed
{
add => this._resumed.Register(value);
remove => this._resumed.Unregister(value);
}
private AsyncEvent _resumed;
///
/// Fired on received heartbeat ACK.
///
public event AsyncEventHandler Heartbeated
{
add => this._heartbeated.Register(value);
remove => this._heartbeated.Unregister(value);
}
private AsyncEvent _heartbeated;
#endregion
#region Channel
///
/// Fired when a new channel is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ChannelCreated
{
add => this._channelCreated.Register(value);
remove => this._channelCreated.Unregister(value);
}
private AsyncEvent _channelCreated;
///
/// Fired when a channel is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ChannelUpdated
{
add => this._channelUpdated.Register(value);
remove => this._channelUpdated.Unregister(value);
}
private AsyncEvent _channelUpdated;
///
/// Fired when a channel is deleted
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ChannelDeleted
{
add => this._channelDeleted.Register(value);
remove => this._channelDeleted.Unregister(value);
}
private AsyncEvent _channelDeleted;
///
/// Fired when a dm channel is deleted
/// For this Event you need the intent specified in
///
public event AsyncEventHandler DmChannelDeleted
{
add => this._dmChannelDeleted.Register(value);
remove => this._dmChannelDeleted.Unregister(value);
}
private AsyncEvent _dmChannelDeleted;
///
/// Fired whenever a channel's pinned message list is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ChannelPinsUpdated
{
add => this._channelPinsUpdated.Register(value);
remove => this._channelPinsUpdated.Unregister(value);
}
private AsyncEvent _channelPinsUpdated;
#endregion
#region Guild
///
/// Fired when the user joins a new guild.
/// For this Event you need the intent specified in
///
/// [alias="GuildJoined"][alias="JoinedGuild"]
public event AsyncEventHandler GuildCreated
{
add => this._guildCreated.Register(value);
remove => this._guildCreated.Unregister(value);
}
private AsyncEvent _guildCreated;
///
/// Fired when a guild is becoming available.
///
public event AsyncEventHandler GuildAvailable
{
add => this._guildAvailable.Register(value);
remove => this._guildAvailable.Unregister(value);
}
private AsyncEvent _guildAvailable;
///
/// Fired when a guild is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildUpdated
{
add => this._guildUpdated.Register(value);
remove => this._guildUpdated.Unregister(value);
}
private AsyncEvent _guildUpdated;
///
/// Fired when the user leaves or is removed from a guild.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildDeleted
{
add => this._guildDeleted.Register(value);
remove => this._guildDeleted.Unregister(value);
}
private AsyncEvent _guildDeleted;
///
/// Fired when a guild becomes unavailable.
///
public event AsyncEventHandler GuildUnavailable
{
add => this._guildUnavailable.Register(value);
remove => this._guildUnavailable.Unregister(value);
}
private AsyncEvent _guildUnavailable;
///
/// Fired when all guilds finish streaming from Discord.
///
public event AsyncEventHandler GuildDownloadCompleted
{
add => this._guildDownloadCompleted.Register(value);
remove => this._guildDownloadCompleted.Unregister(value);
}
private AsyncEvent _guildDownloadCompleted;
///
/// Fired when a guilds emojis get updated
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildEmojisUpdated
{
add => this._guildEmojisUpdated.Register(value);
remove => this._guildEmojisUpdated.Unregister(value);
}
private AsyncEvent _guildEmojisUpdated;
///
/// Fired when a guilds stickers get updated
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildStickersUpdated
{
add => this._guildStickersUpdated.Register(value);
remove => this._guildStickersUpdated.Unregister(value);
}
private AsyncEvent _guildStickersUpdated;
///
/// Fired when a guild integration is updated.
///
public event AsyncEventHandler GuildIntegrationsUpdated
{
add => this._guildIntegrationsUpdated.Register(value);
remove => this._guildIntegrationsUpdated.Unregister(value);
}
private AsyncEvent _guildIntegrationsUpdated;
#endregion
#region Guild Ban
///
/// Fired when a guild ban gets added
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildBanAdded
{
add => this._guildBanAdded.Register(value);
remove => this._guildBanAdded.Unregister(value);
}
private AsyncEvent _guildBanAdded;
///
/// Fired when a guild ban gets removed
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildBanRemoved
{
add => this._guildBanRemoved.Register(value);
remove => this._guildBanRemoved.Unregister(value);
}
private AsyncEvent _guildBanRemoved;
#endregion
#region Guild Event
///
/// Fired when a scheduled event is created.
- /// For this Event you need the intent specified in
+ /// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventCreated
{
add => this._guildScheduledEventCreated.Register(value);
remove => this._guildScheduledEventCreated.Unregister(value);
}
private AsyncEvent _guildScheduledEventCreated;
///
/// Fired when a scheduled event is updated.
- /// For this Event you need the intent specified in
+ /// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventUpdated
{
add => this._guildScheduledEventUpdated.Register(value);
remove => this._guildScheduledEventUpdated.Unregister(value);
}
private AsyncEvent _guildScheduledEventUpdated;
///
/// Fired when a scheduled event is deleted.
- /// For this Event you need the intent specified in
+ /// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventDeleted
{
add => this._guildScheduledEventDeleted.Register(value);
remove => this._guildScheduledEventDeleted.Unregister(value);
}
private AsyncEvent _guildScheduledEventDeleted;
///
/// Fired when a user subscribes to a scheduled event.
- /// For this Event you need the intent specified in
+ /// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventUserAdded
{
add => this._guildScheduledEventUserAdded.Register(value);
remove => this._guildScheduledEventUserAdded.Unregister(value);
}
private AsyncEvent _guildScheduledEventUserAdded;
///
/// Fired when a user unsubscribes from a scheduled event.
- /// For this Event you need the intent specified in
+ /// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventUserRemoved
{
add => this._guildScheduledEventUserRemoved.Register(value);
remove => this._guildScheduledEventUserRemoved.Unregister(value);
}
private AsyncEvent _guildScheduledEventUserRemoved;
#endregion
#region Guild Integration
///
/// Fired when a guild integration is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildIntegrationCreated
{
add => this._guildIntegrationCreated.Register(value);
remove => this._guildIntegrationCreated.Unregister(value);
}
private AsyncEvent _guildIntegrationCreated;
///
/// Fired when a guild integration is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildIntegrationUpdated
{
add => this._guildIntegrationUpdated.Register(value);
remove => this._guildIntegrationUpdated.Unregister(value);
}
private AsyncEvent _guildIntegrationUpdated;
///
/// Fired when a guild integration is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildIntegrationDeleted
{
add => this._guildIntegrationDeleted.Register(value);
remove => this._guildIntegrationDeleted.Unregister(value);
}
private AsyncEvent _guildIntegrationDeleted;
#endregion
#region Guild Member
///
/// Fired when a new user joins a guild.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildMemberAdded
{
add => this._guildMemberAdded.Register(value);
remove => this._guildMemberAdded.Unregister(value);
}
private AsyncEvent _guildMemberAdded;
///
/// Fired when a user is removed from a guild (leave/kick/ban).
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildMemberRemoved
{
add => this._guildMemberRemoved.Register(value);
remove => this._guildMemberRemoved.Unregister(value);
}
private AsyncEvent _guildMemberRemoved;
///
/// Fired when a guild member is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildMemberUpdated
{
add => this._guildMemberUpdated.Register(value);
remove => this._guildMemberUpdated.Unregister(value);
}
private AsyncEvent _guildMemberUpdated;
///
/// Fired in response to Gateway Request Guild Members.
///
public event AsyncEventHandler GuildMembersChunked
{
add => this._guildMembersChunk.Register(value);
remove => this._guildMembersChunk.Unregister(value);
}
private AsyncEvent _guildMembersChunk;
#endregion
#region Guild Role
///
/// Fired when a guild role is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildRoleCreated
{
add => this._guildRoleCreated.Register(value);
remove => this._guildRoleCreated.Unregister(value);
}
private AsyncEvent _guildRoleCreated;
///
/// Fired when a guild role is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildRoleUpdated
{
add => this._guildRoleUpdated.Register(value);
remove => this._guildRoleUpdated.Unregister(value);
}
private AsyncEvent _guildRoleUpdated;
///
/// Fired when a guild role is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildRoleDeleted
{
add => this._guildRoleDeleted.Register(value);
remove => this._guildRoleDeleted.Unregister(value);
}
private AsyncEvent _guildRoleDeleted;
#endregion
#region Invite
///
/// Fired when an invite is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler InviteCreated
{
add => this._inviteCreated.Register(value);
remove => this._inviteCreated.Unregister(value);
}
private AsyncEvent _inviteCreated;
///
/// Fired when an invite is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler InviteDeleted
{
add => this._inviteDeleted.Register(value);
remove => this._inviteDeleted.Unregister(value);
}
private AsyncEvent _inviteDeleted;
#endregion
#region Message
///
/// Fired when a message is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageCreated
{
add => this._messageCreated.Register(value);
remove => this._messageCreated.Unregister(value);
}
private AsyncEvent _messageCreated;
///
/// Fired when a message is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageUpdated
{
add => this._messageUpdated.Register(value);
remove => this._messageUpdated.Unregister(value);
}
private AsyncEvent _messageUpdated;
///
/// Fired when a message is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageDeleted
{
add => this._messageDeleted.Register(value);
remove => this._messageDeleted.Unregister(value);
}
private AsyncEvent _messageDeleted;
///
/// Fired when multiple messages are deleted at once.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessagesBulkDeleted
{
add => this._messageBulkDeleted.Register(value);
remove => this._messageBulkDeleted.Unregister(value);
}
private AsyncEvent _messageBulkDeleted;
#endregion
#region Message Reaction
///
/// Fired when a reaction gets added to a message.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageReactionAdded
{
add => this._messageReactionAdded.Register(value);
remove => this._messageReactionAdded.Unregister(value);
}
private AsyncEvent _messageReactionAdded;
///
/// Fired when a reaction gets removed from a message.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageReactionRemoved
{
add => this._messageReactionRemoved.Register(value);
remove => this._messageReactionRemoved.Unregister(value);
}
private AsyncEvent _messageReactionRemoved;
///
/// Fired when all reactions get removed from a message.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageReactionsCleared
{
add => this._messageReactionsCleared.Register(value);
remove => this._messageReactionsCleared.Unregister(value);
}
private AsyncEvent _messageReactionsCleared;
///
/// Fired when all reactions of a specific reaction are removed from a message.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageReactionRemovedEmoji
{
add => this._messageReactionRemovedEmoji.Register(value);
remove => this._messageReactionRemovedEmoji.Unregister(value);
}
private AsyncEvent _messageReactionRemovedEmoji;
#endregion
#region Stage Instance
///