diff --git a/DisCatSharp/Entities/Interaction/Components/DiscordTextComponent.cs b/DisCatSharp/Entities/Interaction/Components/DiscordTextComponent.cs
new file mode 100644
index 000000000..8276c7a2d
--- /dev/null
+++ b/DisCatSharp/Entities/Interaction/Components/DiscordTextComponent.cs
@@ -0,0 +1,118 @@
+// 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 DisCatSharp.Enums;
+using DisCatSharp.EventArgs;
+using Newtonsoft.Json;
+
+namespace DisCatSharp.Entities
+{
+
+ ///
+ /// Represents a text that can be submitted. Fires when submitted.
+ ///
+ public sealed class DiscordTextComponent : DiscordComponent
+ {
+ ///
+ /// The style of the text.
+ ///
+ [JsonProperty("text_style", NullValueHandling = NullValueHandling.Ignore)]
+ public TextComponentStyle Style { get; internal set; }
+
+ ///
+ /// The text to apply to the button. If this is not specified becomes required.
+ ///
+ [JsonProperty("label", NullValueHandling = NullValueHandling.Ignore)]
+ public string Label { get; internal set; }
+
+ ///
+ /// Whether this button can be pressed.
+ ///
+ [JsonProperty("disabled", NullValueHandling = NullValueHandling.Ignore)]
+ public bool Disabled { get; internal set; }
+
+ ///
+ /// The emoji to add to the button. Can be used in conjunction with a label, or as standalone. Must be added if label is not specified.
+ ///
+ [JsonProperty("emoji", NullValueHandling = NullValueHandling.Ignore)]
+ public DiscordComponentEmoji Emoji { get; internal set; }
+
+ ///
+ /// Enables this component if it was disabled before.
+ ///
+ /// The current component.
+ public DiscordTextComponent Enable()
+ {
+ this.Disabled = false;
+ return this;
+ }
+
+ ///
+ /// Disables this component.
+ ///
+ /// The current component.
+ public DiscordTextComponent Disable()
+ {
+ this.Disabled = true;
+ return this;
+ }
+
+ ///
+ /// Constructs a new .
+ ///
+ internal DiscordTextComponent()
+ {
+ this.Type = ComponentType.InputText;
+ }
+
+ ///
+ /// Constucts a new button based on another button.
+ ///
+ /// The button to copy.
+ public DiscordTextComponent(DiscordTextComponent other) : this()
+ {
+ this.CustomId = other.CustomId;
+ this.Style = other.Style;
+ this.Label = other.Label;
+ this.Disabled = other.Disabled;
+ this.Emoji = other.Emoji;
+ }
+
+ ///
+ /// Constructs a new button with the specified options.
+ ///
+ /// The style/color of the button.
+ /// The Id to assign to the button. This is sent back when a user presses it.
+ /// The text to display on the button, up to 80 characters. Can be left blank if is set.
+ /// Whether this button should be initialized as being disabled. User sees a greyed out button that cannot be interacted with.
+ /// The emoji to add to the button. This is required if is empty or null.
+ public DiscordTextComponent(TextComponentStyle style, string customId, string label, bool disabled = false, DiscordComponentEmoji emoji = null)
+ {
+ this.Style = style;
+ this.Label = label;
+ this.CustomId = customId;
+ this.Disabled = disabled;
+ this.Emoji = emoji;
+ this.Type = ComponentType.InputText;
+ }
+ }
+}
diff --git a/DisCatSharp/Enums/Application/ApplicationCommandType.cs b/DisCatSharp/Enums/Application/ApplicationCommandType.cs
index eaa60a7e6..638b7c840 100644
--- a/DisCatSharp/Enums/Application/ApplicationCommandType.cs
+++ b/DisCatSharp/Enums/Application/ApplicationCommandType.cs
@@ -1,52 +1,57 @@
// This file is part of the DisCatSharp project, a fork of DSharpPlus.
//
// 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 DisCatSharp.Entities;
namespace DisCatSharp.Enums
{
///
/// Represents the type of an .
///
public enum ApplicationCommandType
{
///
/// This command is registered as a slash-command, aka "Chat Input".
///
ChatInput = 1,
///
/// This command is registered as a user context menu, and is applicable when interacting a user.
///
User = 2,
///
/// This command is registered as a message context menu, and is applicable when interacting with a message.
///
Message = 3,
///
/// Inbound only: An auto-complete option is being interacted with.
///
- AutoCompleteRequest = 4
+ AutoCompleteRequest = 4,
+
+ ///
+ /// Inbound only: A modal was submitted.
+ ///
+ ModalSubmit = 5
}
}
diff --git a/DisCatSharp/Enums/Interaction/ButtonStyle.cs b/DisCatSharp/Enums/Interaction/ButtonStyle.cs
index f3538deb8..88d518b19 100644
--- a/DisCatSharp/Enums/Interaction/ButtonStyle.cs
+++ b/DisCatSharp/Enums/Interaction/ButtonStyle.cs
@@ -1,47 +1,50 @@
// 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.
namespace DisCatSharp.Enums
{
///
/// Represents a button's style/color.
///
public enum ButtonStyle : int
{
///
/// Blurple button.
///
Primary = 1,
+
///
/// Grey button.
///
Secondary = 2,
+
///
/// Green button.
///
Success = 3,
+
///
/// Red button.
///
Danger = 4,
}
}
diff --git a/DisCatSharp/Enums/Interaction/ComponentType.cs b/DisCatSharp/Enums/Interaction/ComponentType.cs
index e7faca56c..8c86d38d6 100644
--- a/DisCatSharp/Enums/Interaction/ComponentType.cs
+++ b/DisCatSharp/Enums/Interaction/ComponentType.cs
@@ -1,45 +1,50 @@
// 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.
namespace DisCatSharp.Enums
{
///
/// Represents a type of component.
///
public enum ComponentType
{
///
/// A row of components.
///
ActionRow = 1,
///
/// A button.
///
Button = 2,
///
/// A select menu.
///
- Select = 3
+ Select = 3,
+
+ ///
+ /// A input text.
+ ///
+ InputText = 4
}
}
diff --git a/DisCatSharp/Enums/Interaction/InteractionType.cs b/DisCatSharp/Enums/Interaction/InteractionType.cs
index 565193995..76b56bc96 100644
--- a/DisCatSharp/Enums/Interaction/InteractionType.cs
+++ b/DisCatSharp/Enums/Interaction/InteractionType.cs
@@ -1,50 +1,55 @@
// 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.
namespace DisCatSharp
{
///
/// Represents the type of interaction used.
///
public enum InteractionType
{
///
/// Sent when registering an HTTP interaction endpoint with Discord. Must be replied to with a Pong.
///
Ping = 1,
///
/// An application command.
///
ApplicationCommand = 2,
///
/// A component.
///
Component = 3,
///
/// An autocomplete field.
///
- AutoComplete = 4
+ AutoComplete = 4,
+
+ ///
+ /// A modal component.
+ ///
+ ModalSubmit = 5
}
}
diff --git a/DisCatSharp/Enums/Interaction/ComponentType.cs b/DisCatSharp/Enums/Interaction/TextComponentStyle.cs
similarity index 83%
copy from DisCatSharp/Enums/Interaction/ComponentType.cs
copy to DisCatSharp/Enums/Interaction/TextComponentStyle.cs
index e7faca56c..669579c8b 100644
--- a/DisCatSharp/Enums/Interaction/ComponentType.cs
+++ b/DisCatSharp/Enums/Interaction/TextComponentStyle.cs
@@ -1,45 +1,40 @@
// 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.
namespace DisCatSharp.Enums
{
///
- /// Represents a type of component.
+ /// Represents a button's style/color.
///
- public enum ComponentType
+ public enum TextComponentStyle : int
{
///
- /// A row of components.
+ /// A small text input.
///
- ActionRow = 1,
+ Small = 1,
///
- /// A button.
+ /// A paragraph text input.
///
- Button = 2,
-
- ///
- /// A select menu.
- ///
- Select = 3
+ Paragraph = 2
}
}