sig/discorb/component/text_input.rbs
module Discorb
#
# Represents a text input component.
class TextInput < Discorb::Component
STYLES: untyped
#
# Initialize a new text input component.
#
# @param [String] label The label of the text input.
# @param [String] custom_id The custom id of the text input.
# @param [:short, :paragraph] style The style of the text input.
# @param [Integer, nil] min_length The minimum length of the text input.
# @param [Integer, nil] max_length The maximum length of the text input.
# @param [Boolean] required Whether the text input is required.
# @param [String, nil] value The prefilled value of the text input.
# @param [String, nil] placeholder The placeholder of the text input.
def initialize: (
String label,
String custom_id,
Symbol style,
?min_length: Integer?,
?max_length: Integer?,
?required: bool,
?value: String?,
?placeholder: String?
) -> void
#
# Converts the select menu to a hash.
#
# @see https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-structure
# Official Discord API docs
# @return [Hash] A hash representation of the text input.
%a{pure}
def to_hash: -> Discorb::json
#
# Creates a new text input from a hash.
#
# @param [Hash] data The hash to create the text input from.
#
# @return [Discorb::TextInput] The created text input.
def self.from_hash: (Discorb::json data) -> Discorb::TextInput
# @return [String] The label of the text input.
attr_accessor label: String
# @return [String] The custom id of the text input.
attr_accessor custom_id: String
# @return [:short, :paragraph] The style of the text input.
attr_accessor style: Symbol
# @return [Integer, nil] The minimum length of the text input.
attr_accessor min_length: Integer?
# @return [Integer, nil] The maximum length of the text input.
attr_accessor max_length: Integer?
# @return [Boolean] Whether the text input is required.
attr_accessor required: bool
# @return [String, nil] The prefilled value of the text input.
attr_accessor value: String?
# @return [String, nil] The placeholder of the text input.
attr_accessor placeholder: String?
end
end