Class: Discordrb::Events::ModalSubmitEvent
- Inherits:
-
ComponentEvent
- Object
- Event
- InteractionCreateEvent
- ComponentEvent
- Discordrb::Events::ModalSubmitEvent
- Defined in:
- lib/discordrb/events/interactions.rb
Overview
An event for when a user submits a modal.
Instance Attribute Summary collapse
-
#components ⇒ Array<Component>
readonly
An array of partial component objects that were in the modal.
-
#resolved ⇒ Resolved
readonly
The resolved channels, roles, users, members, and attachments for the modal.
Attributes inherited from ComponentEvent
Attributes inherited from InteractionCreateEvent
#channel, #channel_id, #context, #interaction, #server, #server_id, #server_integration?, #type, #user, #user_integration?, #user_locale
Attributes inherited from Event
Instance Method Summary collapse
-
#attachments(custom_id) ⇒ Array<Attachment>
Get the attachments that a user uploaded in this modal.
-
#value(custom_id) ⇒ String?
Get the value of an input passed to the modal.
-
#values(custom_id) ⇒ Array<String>?
Get the selected values from a select menu or file upload component.
Methods inherited from InteractionCreateEvent
#defer, #defer_update, #delete_message, #delete_response, #edit_message, #edit_response, #get_component, #respond, #send_message, #show_modal, #update_message
Instance Attribute Details
#components ⇒ Array<Component> (readonly)
Returns an array of partial component objects that were in the modal.
410 411 412 |
# File 'lib/discordrb/events/interactions.rb', line 410 def components @components end |
#resolved ⇒ Resolved (readonly)
Returns The resolved channels, roles, users, members, and attachments for the modal.
413 414 415 |
# File 'lib/discordrb/events/interactions.rb', line 413 def resolved @resolved end |
Instance Method Details
#attachments(custom_id) ⇒ Array<Attachment>
Get the attachments that a user uploaded in this modal.
440 441 442 |
# File 'lib/discordrb/events/interactions.rb', line 440 def (custom_id) values(custom_id)&.map { |id| @resolved[:attachments][id.to_i] } || [] end |
#value(custom_id) ⇒ String?
Get the value of an input passed to the modal.
426 427 428 |
# File 'lib/discordrb/events/interactions.rb', line 426 def value(custom_id) get_component(custom_id)&.value end |
#values(custom_id) ⇒ Array<String>?
Get the selected values from a select menu or file upload component.
433 434 435 |
# File 'lib/discordrb/events/interactions.rb', line 433 def values(custom_id) get_component(custom_id)&.values end |