Class: Twitch::Bot::RoomStateCommandParser

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

Overview

Parses a ROOMSTATE 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



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/twitch/bot/message_parser.rb', line 102

def call
  roomstate_tags = {
    "slow" => SlowModeParser,
    "followers-only" => FollowersOnlyModeParser,
    "subs-only" => SubsOnlyModeParser,
    "r9k" => R9kModeParser,
  }

  roomstate_tags.each do |tag, parser|
    if message.tags.include?(tag)
      return parser.new(message).call
    end
  end

  Message::NotSupported.new(message)
end