Class: Discordrb::Events::EventHandler
- Inherits:
-
Object
- Object
- Discordrb::Events::EventHandler
- Defined in:
- lib/discordrb/events/generic.rb
Overview
Generic event handler that can be extended
Direct Known Subclasses
ApplicationCommandEventHandler, ApplicationCommandPermissionsUpdateEventHandler, AwaitEventHandler, ChannelCreateEventHandler, ChannelDeleteEventHandler, ChannelPinsUpdateEventHandler, ChannelRecipientEventHandler, InteractionCreateEventHandler, InviteCreateEventHandler, InviteDeleteEventHandler, MessageEventHandler, MessageIDEventHandler, PlayingEventHandler, PresenceEventHandler, RawEventHandler, ReactionEventHandler, ReactionRemoveAllEventHandler, ServerEmojiUpdateEventHandler, ServerEventHandler, ServerMemberEventHandler, ServerRoleCreateEventHandler, ServerRoleDeleteEventHandler, ThreadCreateEventHandler, TrueEventHandler, TypingEventHandler, UserBanEventHandler, VoiceServerUpdateEventHandler, VoiceStateUpdateEventHandler, WebhookUpdateEventHandler
Instance Method Summary collapse
-
#after_call(event) ⇒ Object
to be overwritten by extending event handlers.
-
#call(event) ⇒ Object
Calls this handler.
-
#match(event) ⇒ Object
Checks whether this handler matches the given event, and then calls it.
-
#matches?(_) ⇒ Boolean
Whether or not this event handler matches the given event with its attributes.
- #matches_all(attributes, to_check, &block) ⇒ Object
Instance Method Details
#after_call(event) ⇒ Object
to be overwritten by extending event handlers
104 |
# File 'lib/discordrb/events/generic.rb', line 104 def after_call(event); end |
#call(event) ⇒ Object
Calls this handler
99 100 101 |
# File 'lib/discordrb/events/generic.rb', line 99 def call(event) @block.call(event) end |
#match(event) ⇒ Object
Checks whether this handler matches the given event, and then calls it.
93 94 95 |
# File 'lib/discordrb/events/generic.rb', line 93 def match(event) call(event) if matches? event end |
#matches?(_) ⇒ Boolean
Whether or not this event handler matches the given event with its attributes.
87 88 89 |
# File 'lib/discordrb/events/generic.rb', line 87 def matches?(_) raise 'Attempted to call matches?() from a generic EventHandler' end |
#matches_all(attributes, to_check, &block) ⇒ Object
107 108 109 |
# File 'lib/discordrb/events/generic.rb', line 107 def matches_all(attributes, to_check, &block) Discordrb::Events.matches_all(attributes, to_check, &block) end |