Class: SlackBotServer::RemoteControl
- Inherits:
-
Object
- Object
- SlackBotServer::RemoteControl
- Defined in:
- lib/slack_bot_server/remote_control.rb
Overview
Send commands to a running SlackBotServer::Server instance
This should be initialized with a queue that is shared with the targetted server (e.g. the same local queue instance, or a redis queue instance that points at the same redis server).
Instance Method Summary collapse
- #add_bot(*args) ⇒ Object
- #broadcast(key, message_data) ⇒ Object
- #call(key, method, args) ⇒ Object
-
#initialize(queue:) ⇒ RemoteControl
constructor
A new instance of RemoteControl.
- #remove_bot(key) ⇒ Object
- #say(key, message_data) ⇒ Object
- #say_to(key, user_id, message_data) ⇒ Object
Constructor Details
#initialize(queue:) ⇒ RemoteControl
Returns a new instance of RemoteControl.
8 9 10 |
# File 'lib/slack_bot_server/remote_control.rb', line 8 def initialize(queue:) @queue = queue end |
Instance Method Details
#add_bot(*args) ⇒ Object
12 13 14 |
# File 'lib/slack_bot_server/remote_control.rb', line 12 def add_bot(*args) @queue.push([:add_bot, *args]) end |
#broadcast(key, message_data) ⇒ Object
20 21 22 |
# File 'lib/slack_bot_server/remote_control.rb', line 20 def broadcast(key, ) @queue.push([:broadcast, key, ]) end |
#call(key, method, args) ⇒ Object
32 33 34 |
# File 'lib/slack_bot_server/remote_control.rb', line 32 def call(key, method, args) @queue.push([:call, [key, method, args]]) end |
#remove_bot(key) ⇒ Object
16 17 18 |
# File 'lib/slack_bot_server/remote_control.rb', line 16 def remove_bot(key) @queue.push([:remove_bot, key]) end |
#say(key, message_data) ⇒ Object
24 25 26 |
# File 'lib/slack_bot_server/remote_control.rb', line 24 def say(key, ) @queue.push([:say, key, ]) end |
#say_to(key, user_id, message_data) ⇒ Object
28 29 30 |
# File 'lib/slack_bot_server/remote_control.rb', line 28 def say_to(key, user_id, ) @queue.push([:say_to, key, user_id, ]) end |