diff --git a/DisCatSharp/EventArgs/Interaction/InteractionCreateEventArgs.cs b/DisCatSharp/EventArgs/Interaction/ButtonInteractionEventArgs.cs similarity index 67% copy from DisCatSharp/EventArgs/Interaction/InteractionCreateEventArgs.cs copy to DisCatSharp/EventArgs/Interaction/ButtonInteractionEventArgs.cs index a4801a551..5135a45c9 100644 --- a/DisCatSharp/EventArgs/Interaction/InteractionCreateEventArgs.cs +++ b/DisCatSharp/EventArgs/Interaction/ButtonInteractionEventArgs.cs @@ -1,45 +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; +namespace DisCatSharp.EventArgs.Interaction; /// -/// Represents arguments for +/// Represents arguments for . +/// Used for button interactions. /// -public class InteractionCreateEventArgs : DiscordEventArgs +internal class ButtonInteractionEventArgs : DiscordEventArgs { /// /// Gets the interaction data that was invoked. /// public DiscordInteraction Interaction { get; internal set; } /// - /// Initializes a new instance of the class. + /// 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 InteractionCreateEventArgs(IServiceProvider provider) : base(provider) + public ButtonInteractionEventArgs(IServiceProvider provider) + : base(provider) { } } diff --git a/DisCatSharp/EventArgs/Interaction/ContextMenuInteractionCreateEventArgs.cs b/DisCatSharp/EventArgs/Interaction/ContextMenuInteractionCreateEventArgs.cs index 4e3fdc821..bbd2a8dd7 100644 --- a/DisCatSharp/EventArgs/Interaction/ContextMenuInteractionCreateEventArgs.cs +++ b/DisCatSharp/EventArgs/Interaction/ContextMenuInteractionCreateEventArgs.cs @@ -1,61 +1,62 @@ // 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; using DisCatSharp.Enums; namespace DisCatSharp.EventArgs; /// /// The context menu interaction create event args. /// public sealed class ContextMenuInteractionCreateEventArgs : InteractionCreateEventArgs { /// - /// The type of context menu that was used. This is never . + /// The type of context menu that was used. This is never . /// public ApplicationCommandType Type { get; internal set; } /// /// The user that invoked this interaction. Can be cast to a member if this was on a guild. /// public DiscordUser User => this.Interaction.User; /// /// The user this interaction targets, if applicable. /// public DiscordUser TargetUser { get; internal set; } /// /// The message this interaction targets, if applicable. /// public DiscordMessage TargetMessage { get; internal set; } /// /// Initializes a new instance of the class. /// /// The provider. - public ContextMenuInteractionCreateEventArgs(IServiceProvider provider) : base(provider) + public ContextMenuInteractionCreateEventArgs(IServiceProvider provider) + : base(provider) { } } diff --git a/DisCatSharp/EventArgs/Interaction/InteractionCreateEventArgs.cs b/DisCatSharp/EventArgs/Interaction/InteractionCreateEventArgs.cs index a4801a551..e0fa91cc7 100644 --- a/DisCatSharp/EventArgs/Interaction/InteractionCreateEventArgs.cs +++ b/DisCatSharp/EventArgs/Interaction/InteractionCreateEventArgs.cs @@ -1,45 +1,46 @@ // 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 /// public class InteractionCreateEventArgs : DiscordEventArgs { /// /// Gets the interaction data that was invoked. /// public DiscordInteraction Interaction { get; internal set; } /// /// Initializes a new instance of the class. /// /// The provider. - public InteractionCreateEventArgs(IServiceProvider provider) : base(provider) + public InteractionCreateEventArgs(IServiceProvider provider) + : base(provider) { } } diff --git a/DisCatSharp/EventArgs/Interaction/InteractionCreateEventArgs.cs b/DisCatSharp/EventArgs/Interaction/SelectMenuInteractionEventArgs.cs similarity index 60% copy from DisCatSharp/EventArgs/Interaction/InteractionCreateEventArgs.cs copy to DisCatSharp/EventArgs/Interaction/SelectMenuInteractionEventArgs.cs index a4801a551..515a12fbe 100644 --- a/DisCatSharp/EventArgs/Interaction/InteractionCreateEventArgs.cs +++ b/DisCatSharp/EventArgs/Interaction/SelectMenuInteractionEventArgs.cs @@ -1,45 +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; +namespace DisCatSharp.EventArgs.Interaction; /// -/// Represents arguments for +/// Represents arguments for . +/// Used for select menu interactions. /// -public class InteractionCreateEventArgs : DiscordEventArgs +internal class SelectMenuInteractionEventArgs : DiscordEventArgs { /// /// Gets the interaction data that was invoked. /// public DiscordInteraction Interaction { get; internal set; } /// - /// Initializes a new instance of the class. + /// 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 InteractionCreateEventArgs(IServiceProvider provider) : base(provider) + public SelectMenuInteractionEventArgs(IServiceProvider provider) + : base(provider) { } }