Class: Spunk::Processor::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/spunk/base_parser.rb

Instance Method Summary collapse

Instance Method Details

#call(bot, origin, command, parameters) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/spunk/base_parser.rb', line 4

def call(bot, origin, command, parameters)
  if command =~ /^INVITE #{bot.nickname}$/i
    room = Spunk::Helpers.parse_room(parameters)
    if room
      bot.join_room(room)
    end
  end
  if command =~ /^KICK (#\S+)\W(.*)\W?/
    # Remove from array of joined_rooms when kicked
    nick = $2
    if bot.nickname == nick
      room = [$1]
      bot.joined_rooms -= room
    end
  end
end