Class: Twitch::Bot::PrivMsgCommandParser

Inherits:
CommandParser show all
Defined in:
lib/twitch/bot/message_parser.rb

Overview

Parses a PRIVMSG IRC command

Instance Attribute Summary

Attributes inherited from CommandParser

#message

Instance Method Summary collapse

Methods inherited from CommandParser

#initialize

Constructor Details

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

Instance Method Details

#callObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/twitch/bot/message_parser.rb', line 56

def call
  user = message.user
  text = message.text
  if user == "twitchnotify"
    if text.match?(/just subscribed!/)
      Message::Subscription.new(
        user: message.params.last.split(" ").first,
      )
    else
      Message::NotSupported.new(message)
    end
  else
    Message::UserMessage.new(text: text, user: user)
  end
end