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
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/discordrb/events/interactions.rb', line 345 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 |