Class: OnyxCord::Events::ComponentEventHandler
- Inherits:
-
InteractionCreateEventHandler
- Object
- EventHandler
- InteractionCreateEventHandler
- OnyxCord::Events::ComponentEventHandler
- Defined in:
- lib/onyxcord/events/interactions/components.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, #match, #matches_all
Instance Method Details
#matches?(event) ⇒ Boolean
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/onyxcord/events/interactions/components.rb', line 28 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 |