Class: Discordrb::Events::ComponentEventHandler
- Inherits:
-
InteractionCreateEventHandler
- Object
- EventHandler
- InteractionCreateEventHandler
- Discordrb::Events::ComponentEventHandler
- Defined in:
- lib/discordrb/events/interactions.rb
Overview
Generic handler for component events.
Direct Known Subclasses
ButtonEventHandler, ChannelSelectEventHandler, MentionableSelectEventHandler, ModalSubmitEventHandler, RoleSelectEventHandler, StringSelectEventHandler, UserSelectEventHandler
Instance Method Summary collapse
Methods inherited from EventHandler
#after_call, #call, #initialize, #match, #matches_all
Constructor Details
This class inherits a constructor from Discordrb::Events::EventHandler
Instance Method Details
#matches?(event) ⇒ Boolean
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File 'lib/discordrb/events/interactions.rb', line 381 def matches?(event) return false unless super return false unless event.is_a? ComponentEvent [ matches_all(@attributes[:custom_id], event.custom_id) do |a, e| # Match regexp and strings case a when Regexp a.match?(e) else a == e end end, matches_all(@attributes[:message], event.) do |a, e| case a when String, Integer a.resolve_id == e.id else a.id == e.id end end ].reduce(&:&) end |