Class: Discordrb::Events::UserBanEventHandler
- Inherits:
-
EventHandler
- Object
- EventHandler
- Discordrb::Events::UserBanEventHandler
- Defined in:
- lib/discordrb/events/bans.rb
Overview
Event handler for UserBanEvent
Direct Known Subclasses
Instance Method Summary collapse
Methods inherited from EventHandler
#call, #initialize, #match, #matches_all
Constructor Details
This class inherits a constructor from Discordrb::Events::EventHandler
Instance Method Details
#matches?(event) ⇒ Boolean
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/discordrb/events/bans.rb', line 22 def matches?(event) # Check for the proper event type return false unless event.is_a? UserBanEvent [ matches_all(@attributes[:user], event.user) do |a, e| if a.is_a? String a == e.name elsif a.is_a? Integer a == e.id elsif a == :bot e.bot? else a == e end end, matches_all(@attributes[:server], event.server) do |a, e| if a.is_a? String a == e.name elsif a.is_a? Integer a == e.id else a == e end end ].reduce(true, &:&) end |