Class: Twitch::Bot::Client::ModeHandler

Inherits:
EventHandler show all
Defined in:
lib/twitch/bot/default_handlers.rb

Overview

Handle a change in moderators on the channel.

Instance Attribute Summary

Attributes inherited from EventHandler

#client, #event

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from EventHandler

#initialize

Constructor Details

This class inherits a constructor from Twitch::Bot::EventHandler

Class Method Details

.handled_eventsObject



41
42
43
# File 'lib/twitch/bot/default_handlers.rb', line 41

def self.handled_events
  [:mode]
end

Instance Method Details

#callObject



31
32
33
34
35
36
37
38
39
# File 'lib/twitch/bot/default_handlers.rb', line 31

def call
  user = event.user
  case event.mode
  when :add_moderator
    client.add_moderator(user)
  when :remove_moderator
    client.remove_moderator(user)
  end
end