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>)


435
436
437
# File 'lib/discordrb/events/interactions.rb', line 435

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:



440
441
442
# File 'lib/discordrb/events/interactions.rb', line 440

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