Class: Scamp::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/scamp/action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bot, action, message) ⇒ Action

Returns a new instance of Action.



14
15
16
17
18
# File 'lib/scamp/action.rb', line 14

def initialize(bot, action, message)
  @bot = bot
  @action = action
  @message = message
end

Instance Attribute Details

#botObject

Returns the value of attribute bot.



12
13
14
# File 'lib/scamp/action.rb', line 12

def bot
  @bot
end

#matchesObject

Returns the value of attribute matches.



12
13
14
# File 'lib/scamp/action.rb', line 12

def matches
  @matches
end

Instance Method Details

#command_listObject



54
55
56
# File 'lib/scamp/action.rb', line 54

def command_list
  bot.command_list
end

#messageObject



46
47
48
# File 'lib/scamp/action.rb', line 46

def message
  @message[:body]
end

#paste(msg, room_id_or_name = room_id) ⇒ Object



62
63
64
# File 'lib/scamp/action.rb', line 62

def paste(msg, room_id_or_name = room_id)
  bot.paste(msg, room_id_or_name)
end

#play(sound, room_id_or_name = room_id) ⇒ Object



66
67
68
# File 'lib/scamp/action.rb', line 66

def play(sound, room_id_or_name = room_id)
  bot.play(sound, room_id_or_name)
end

#roomObject



34
35
36
# File 'lib/scamp/action.rb', line 34

def room
  bot.room_name_for @message[:room_id]
end

#room_idObject



30
31
32
# File 'lib/scamp/action.rb', line 30

def room_id
  @message[:room_id]
end

#runObject



50
51
52
# File 'lib/scamp/action.rb', line 50

def run
  self.instance_eval &@action
end

#say(msg, room_id_or_name = room_id) ⇒ Object



58
59
60
# File 'lib/scamp/action.rb', line 58

def say(msg, room_id_or_name = room_id)
  bot.say(msg, room_id_or_name)
end

#userObject



38
39
40
# File 'lib/scamp/action.rb', line 38

def user
  bot.username_for(@message[:user_id])
end

#user_idObject



42
43
44
# File 'lib/scamp/action.rb', line 42

def user_id
  @message[:user_id]
end