class Twitch::Bot::CommandHandler

Base class for implementing chat commands

Attributes

command_aliases[R]

Public Class Methods

handled_events() click to toggle source
# File lib/twitch/bot/command_handler.rb, line 7
def self.handled_events
  [:user_message]
end
new(event:, client:) click to toggle source
Calls superclass method
# File lib/twitch/bot/command_handler.rb, line 11
def initialize(event:, client:)
  super
  @command_aliases = []
end

Public Instance Methods

call() click to toggle source
# File lib/twitch/bot/command_handler.rb, line 16
def call
  if event.command? && command_aliases.include?(event.command)
    handle_command
  end
end
command_alias(command_alias) click to toggle source
# File lib/twitch/bot/command_handler.rb, line 22
def command_alias(command_alias)
  @command_aliases << command_alias
end

Private Instance Methods

handle_command() click to toggle source
# File lib/twitch/bot/command_handler.rb, line 30
def handle_command
  raise NotImplementedError
end