diff --git a/DisCatSharp/Enums/DiscordEvent.cs b/DisCatSharp/Enums/DiscordEvent.cs
index a511f5708..5413923f7 100644
--- a/DisCatSharp/Enums/DiscordEvent.cs
+++ b/DisCatSharp/Enums/DiscordEvent.cs
@@ -1,305 +1,305 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2023 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.
#nullable enable
using System;
namespace DisCatSharp;
///
/// Methods marked with this attribute will be registered as modal handling methods.
///
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public class ModalInteractionAttribute : InteractionAttribute
{
///
/// The custom id to listen for.
///
internal readonly string CustomId;
///
/// Registers a method as modal handler.
///
/// The custom id of the modal to handle.
public ModalInteractionAttribute(string custom_id)
- : base("InteractionCreated")
+ : base("ComponentInteractionCreated")
{
this.CustomId = custom_id;
}
}
///
/// Methods marked with this attribute will be registered as modal handling methods.
/// Modal custom ids will be checked with .
///
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public class ModalInteractionWithPrefixAttribute : InteractionAttribute
{
///
/// The custom id to listen for.
///
internal readonly string CustomIdPrefix;
///
/// Registers a method as modal handler.
///
/// The custom id prefix of the modal to handle.
public ModalInteractionWithPrefixAttribute(string custom_id_prefix)
- : base("InteractionCreated", true)
+ : base("ComponentInteractionCreated", true)
{
this.CustomIdPrefix = custom_id_prefix;
}
}
///
/// Methods marked with this attribute will be registered as button handling methods.
///
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public class ButtonInteractionAttribute : InteractionAttribute
{
///
/// The custom id to listen for.
///
internal readonly string CustomId;
///
/// Registers a method as button handler.
///
/// The custom id of the button to handle.
public ButtonInteractionAttribute(string custom_id)
: base("ComponentInteractionCreated")
{
this.CustomId = custom_id;
}
}
///
/// Methods marked with this attribute will be registered as button handling methods.
/// Modal custom ids will be checked with .
///
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public class ButtonInteractionWithPrefixAttribute : InteractionAttribute
{
///
/// The custom id to listen for.
///
internal readonly string CustomIdPrefix;
///
/// Registers a method as button handler.
///
/// The custom id prefix of the button to handle.
public ButtonInteractionWithPrefixAttribute(string custom_id_prefix)
: base("ComponentInteractionCreated", true)
{
this.CustomIdPrefix = custom_id_prefix;
}
}
///
/// Methods marked with this attribute will be registered as select menu handling methods.
///
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public class SelectInteractionAttribute : InteractionAttribute
{
///
/// The custom id to listen for.
///
internal readonly string CustomId;
///
/// Registers a method as select menu handler.
///
/// The custom id of the select menu to handle.
public SelectInteractionAttribute(string custom_id)
: base("ComponentInteractionCreated")
{
this.CustomId = custom_id;
}
}
///
/// Methods marked with this attribute will be registered as select menu handling methods.
/// Modal custom ids will be checked with .
///
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public class SelectMenuInteractionWithPrefixAttribute : InteractionAttribute
{
///
/// The custom id to listen for.
///
internal readonly string CustomIdPrefix;
///
/// Registers a method as select menu handler.
///
/// The custom id prefix of the select menu to handle.
public SelectMenuInteractionWithPrefixAttribute(string custom_id_prefix)
: base("ComponentInteractionCreated", true)
{
this.CustomIdPrefix = custom_id_prefix;
}
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
public class InteractionAttribute : Attribute
{
internal readonly string EventName;
internal readonly bool IsPrefixed;
public InteractionAttribute(string event_name, bool prefixed = false)
{
this.EventName = event_name;
this.IsPrefixed = prefixed;
}
}
///
/// Classes marked with this attribute will be considered for event handler registration from an assembly.
///
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class InteractionHandlerAttribute : Attribute { }
///
/// Methods marked with this attribute will be registered as event handling methods
/// if the associated type / an associated instance is being registered.
///
[AttributeUsage(AttributeTargets.Method)]
public class EventAttribute : Attribute
{
///
/// The event name to listen for.
///
internal readonly string? EventName;
public EventAttribute() { }
///
/// Registers a method as event handler.
///
/// The name of the event.
/// The attributed method's name will be used if null.
public EventAttribute(DiscordEvent evtn)
{
this.EventName = evtn.ToString();
}
}
///
/// Classes marked with this attribute will be considered for event handler registration from an assembly.
///
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class EventHandlerAttribute : Attribute { }
///
/// All events available in for use with .
///
public enum DiscordEvent
{
ApplicationCommandCreated,
ApplicationCommandDeleted,
ApplicationCommandPermissionsUpdated,
ApplicationCommandUpdated,
ChannelCreated,
ChannelDeleted,
ChannelPinsUpdated,
ChannelUpdated,
ClientErrored,
ComponentInteractionCreated,
ContextMenuInteractionCreated,
DmChannelDeleted,
EmbeddedActivityUpdated,
GuildApplicationCommandCountUpdated,
GuildAvailable,
GuildBanAdded,
GuildBanRemoved,
GuildCreated,
GuildDeleted,
GuildDownloadCompleted,
GuildEmojisUpdated,
GuildIntegrationCreated,
GuildIntegrationDeleted,
GuildIntegrationsUpdated,
GuildIntegrationUpdated,
GuildMemberAdded,
GuildMemberRemoved,
GuildMembersChunked,
GuildMemberTimeoutAdded,
GuildMemberTimeoutChanged,
GuildMemberTimeoutRemoved,
GuildMemberUpdated,
GuildRoleCreated,
GuildRoleDeleted,
GuildRoleUpdated,
GuildScheduledEventCreated,
GuildScheduledEventDeleted,
GuildScheduledEventUpdated,
GuildScheduledEventUserAdded,
GuildScheduledEventUserRemoved,
GuildStickersUpdated,
GuildUnavailable,
GuildUpdated,
Heartbeated,
InteractionCreated,
InviteCreated,
InviteDeleted,
MessageAcknowledged,
MessageCreated,
MessageDeleted,
MessageReactionAdded,
MessageReactionRemoved,
MessageReactionRemovedEmoji,
MessageReactionsCleared,
MessagesBulkDeleted,
MessageUpdated,
PayloadReceived,
PresenceUpdated,
RateLimitHit,
Ready,
Resumed,
SocketClosed,
SocketErrored,
SocketOpened,
StageInstanceCreated,
StageInstanceDeleted,
StageInstanceUpdated,
ThreadCreated,
ThreadDeleted,
ThreadListSynced,
ThreadMembersUpdated,
ThreadMemberUpdated,
ThreadUpdated,
TypingStarted,
UnknownEvent,
UserSettingsUpdated,
UserUpdated,
VoiceServerUpdated,
VoiceStateUpdated,
WebhooksUpdated,
Zombied,
AutomodRuleCreated,
AutomodRuleUpdated,
AutomodRuleDeleted,
AutomodActionExecuted,
GuildAuditLogEntryCreated
}
diff --git a/DisCatSharp/EventArgs/Interaction/ButtonInteractionEventArgs.cs b/DisCatSharp/EventArgs/Interaction/ButtonInteractionEventArgs.cs
index 84531ca9d..c31bfa06e 100644
--- a/DisCatSharp/EventArgs/Interaction/ButtonInteractionEventArgs.cs
+++ b/DisCatSharp/EventArgs/Interaction/ButtonInteractionEventArgs.cs
@@ -1,65 +1,65 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2023 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.Entities;
namespace DisCatSharp.EventArgs;
///
-/// Represents arguments for .
+/// Represents arguments for .
/// Used for button interactions.
///
internal class ButtonInteractionEventArgs : DiscordEventArgs
{
///
/// Gets the interaction data that was invoked.
///
public DiscordInteraction Interaction { get; internal set; }
///
/// Gets the user who executed the button.
///
public DiscordUser User
=> this.Interaction.User;
///
/// Gets the channel in which the button was executed.
///
public DiscordChannel Channel
=> this.Interaction.Channel;
///
/// Gets the custom id of the button.
///
public string CustomId
=> this.Interaction.Data.CustomId;
///
/// Initializes a new instance of the class.
///
/// The provider.
public ButtonInteractionEventArgs(IServiceProvider provider)
: base(provider)
{ }
}
diff --git a/DisCatSharp/EventArgs/Interaction/ModalInteractionEventArgs.cs b/DisCatSharp/EventArgs/Interaction/ModalInteractionEventArgs.cs
index e9bf05641..022a7d1f3 100644
--- a/DisCatSharp/EventArgs/Interaction/ModalInteractionEventArgs.cs
+++ b/DisCatSharp/EventArgs/Interaction/ModalInteractionEventArgs.cs
@@ -1,74 +1,74 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2023 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.Collections.Generic;
using System.Linq;
using DisCatSharp.Entities;
namespace DisCatSharp.EventArgs;
///
-/// Represents arguments for .
+/// Represents arguments for .
/// Used for modal interactions.
///
internal class ModalInteractionEventArgs : DiscordEventArgs
{
///
/// Gets the interaction data that was invoked.
///
public DiscordInteraction Interaction { get; internal set; }
///
/// Gets the modal results simplified as .
/// The key is the components custom id, the value is the components value.
///
public Dictionary ModalResults
=> this.Interaction.Data.Components.ToDictionary(x => x.CustomId, x => x.Value);
///
/// Gets the user who executed the modal.
///
public DiscordUser User
=> this.Interaction.User;
///
/// Gets the channel in which the modal was executed.
///
public DiscordChannel Channel
=> this.Interaction.Channel;
///
/// Gets the custom id of the modal.
///
public string CustomId
=> this.Interaction.Data.CustomId;
///
/// Initializes a new instance of the class.
///
/// The provider.
public ModalInteractionEventArgs(IServiceProvider provider)
: base(provider)
{ }
}
diff --git a/DisCatSharp/EventArgs/Interaction/SelectMenuInteractionEventArgs.cs b/DisCatSharp/EventArgs/Interaction/SelectMenuInteractionEventArgs.cs
index f4175a79d..273c68dd3 100644
--- a/DisCatSharp/EventArgs/Interaction/SelectMenuInteractionEventArgs.cs
+++ b/DisCatSharp/EventArgs/Interaction/SelectMenuInteractionEventArgs.cs
@@ -1,73 +1,73 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2023 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.Collections.Generic;
using System.Linq;
using DisCatSharp.Entities;
namespace DisCatSharp.EventArgs;
///
-/// Represents arguments for .
+/// Represents arguments for .
/// Used for select menu interactions.
///
internal class SelectMenuInteractionEventArgs : DiscordEventArgs
{
///
/// Gets the interaction data that was invoked.
///
public DiscordInteraction Interaction { get; internal set; }
///
/// Gets the select menu values simplified as .
///
public List< string> SelecMenutValues
=> this.Interaction.Data.Values.ToList();
///
/// Gets the user who executed the select menu.
///
public DiscordUser User
=> this.Interaction.User;
///
/// Gets the channel in which the select menu was executed.
///
public DiscordChannel Channel
=> this.Interaction.Channel;
///
/// Gets the custom id of the select menu.
///
public string CustomId
=> this.Interaction.Data.CustomId;
///
/// Initializes a new instance of the class.
///
/// The provider.
public SelectMenuInteractionEventArgs(IServiceProvider provider)
: base(provider)
{ }
}