Class: Twitch::Bot::EventHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/twitch/bot/event_handler.rb

Overview

Handles a message of a specific type

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event:, client:) ⇒ EventHandler

Inititalize an event handler object



24
25
26
27
# File 'lib/twitch/bot/event_handler.rb', line 24

def initialize(event:, client:)
  @event = event
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



7
8
9
# File 'lib/twitch/bot/event_handler.rb', line 7

def client
  @client
end

#eventObject (readonly)

Returns the value of attribute event.



7
8
9
# File 'lib/twitch/bot/event_handler.rb', line 7

def event
  @event
end

Class Method Details

.handled_eventsArray

Return a list of event types this handler subscribes to



14
15
16
# File 'lib/twitch/bot/event_handler.rb', line 14

def self.handled_events
  []
end

Instance Method Details

#callObject

Handle the event



34
35
36
# File 'lib/twitch/bot/event_handler.rb', line 34

def call
  raise "Unhandled #{event.type}"
end