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
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
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/discordrb/events/interactions.rb', line 331 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 |