Class: Twitch::Bot::CommandHandler

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

Overview

Base class for implementing chat commands

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



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

def self.handled_events
  [:user_message]
end

Instance Method Details

#callObject

FIXME: Does this have to be public only for testing?



16
17
18
19
20
# File 'lib/twitch/bot/command_handler.rb', line 16

def call
  if event.command? && command_aliases.include?(event.command)
    handle_command
  end
end

#command_aliasesObject



11
12
13
# File 'lib/twitch/bot/command_handler.rb', line 11

def command_aliases
  []
end