Method: Discordrb::Await#match
- Defined in:
- lib/discordrb/await.rb
#match(event) ⇒ Array
Checks whether the await can be triggered by the given event, and if it can, execute the block and return its result along with this await's key.
42 43 44 45 46 47 48 49 50 |
# File 'lib/discordrb/await.rb', line 42 def match(event) dummy_handler = EventContainer.handler_class(@type).new(@attributes, @bot) return [nil, nil] unless event.instance_of?(@type) && dummy_handler.matches?(event) should_delete = nil should_delete = true if (@block && @block.call(event) != false) || !@block [@key, should_delete] end |