Class: Discordrb::Events::ModalSubmitEvent

Inherits:
ComponentEvent show all
Defined in:
lib/discordrb/events/interactions.rb

Overview

An event for when a user submits a modal.

Instance Attribute Summary collapse

Attributes inherited from ComponentEvent

#custom_id, #message

Attributes inherited from InteractionCreateEvent

#channel, #channel_id, #interaction, #server, #server_id, #type, #user

Attributes inherited from Event

#bot

Instance Method Summary collapse

Methods inherited from InteractionCreateEvent

#defer, #defer_update, #delete_message, #delete_response, #edit_message, #edit_response, #get_component, #initialize, #respond, #send_message, #show_modal, #update_message

Instance Attribute Details

#componentsArray<TextInputComponent> (readonly)

Returns:

  • (Array<TextInputComponent>)


399
400
401
# File 'lib/discordrb/events/interactions.rb', line 399

def components
  @components
end

Instance Method Details

#value(custom_id) ⇒ String?

Get the value of an input passed to the modal.

Parameters:

  • custom_id (String)

    The custom ID of the component to look for.

Returns:



404
405
406
# File 'lib/discordrb/events/interactions.rb', line 404

def value(custom_id)
  get_component(custom_id)&.value
end