Class: Scamp::Action
- Inherits:
-
Object
- Object
- Scamp::Action
- Defined in:
- lib/scamp/action.rb
Instance Attribute Summary collapse
-
#bot ⇒ Object
Returns the value of attribute bot.
-
#matches ⇒ Object
Returns the value of attribute matches.
Instance Method Summary collapse
- #command_list ⇒ Object
-
#initialize(bot, action, message) ⇒ Action
constructor
A new instance of Action.
- #message ⇒ Object
- #paste(msg, room_id_or_name = room_id) ⇒ Object
- #play(sound, room_id_or_name = room_id) ⇒ Object
- #room ⇒ Object
- #room_id ⇒ Object
- #run ⇒ Object
- #say(msg, room_id_or_name = room_id) ⇒ Object
- #user ⇒ Object
- #user_id ⇒ Object
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, ) @bot = bot @action = action @message = end |
Instance Attribute Details
#bot ⇒ Object
Returns the value of attribute bot.
12 13 14 |
# File 'lib/scamp/action.rb', line 12 def bot @bot end |
#matches ⇒ Object
Returns the value of attribute matches.
12 13 14 |
# File 'lib/scamp/action.rb', line 12 def matches @matches end |
Instance Method Details
#command_list ⇒ Object
54 55 56 |
# File 'lib/scamp/action.rb', line 54 def command_list bot.command_list end |
#message ⇒ Object
46 47 48 |
# File 'lib/scamp/action.rb', line 46 def @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 |
#room ⇒ Object
34 35 36 |
# File 'lib/scamp/action.rb', line 34 def room bot.room_name_for @message[:room_id] end |
#room_id ⇒ Object
30 31 32 |
# File 'lib/scamp/action.rb', line 30 def room_id @message[:room_id] end |
#run ⇒ Object
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 |
#user ⇒ Object
38 39 40 |
# File 'lib/scamp/action.rb', line 38 def user bot.username_for(@message[:user_id]) end |
#user_id ⇒ Object
42 43 44 |
# File 'lib/scamp/action.rb', line 42 def user_id @message[:user_id] end |