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
Sends an
add_bot
command to the server. -
#broadcast(key, message_data) ⇒ Object
Sends an
broadcast
command to the server. -
#call(key, method, args) ⇒ Object
Sends a message to be called directly on the slack web API.
-
#initialize(queue:) ⇒ RemoteControl
constructor
Create a new instance of a remote control.
-
#remove_bot(key) ⇒ Object
Sends a
remove_bot
command to the server. -
#say(key, message_data) ⇒ Object
Sends an
say
command to the server. -
#say_to(key, user_id, message_data) ⇒ Object
Sends an
say_to
command to the server.
Constructor Details
#initialize(queue:) ⇒ RemoteControl
Create a new instance of a remote control
10 11 12 |
# File 'lib/slack_bot_server/remote_control.rb', line 10 def initialize(queue:) @queue = queue end |
Instance Method Details
#add_bot(*args) ⇒ Object
Sends an add_bot
command to the server. See Server#add_bot for arguments.
16 17 18 |
# File 'lib/slack_bot_server/remote_control.rb', line 16 def add_bot(*args) @queue.push([:add_bot, *args]) end |
#broadcast(key, message_data) ⇒ Object
Sends an broadcast
command to the server.
30 31 32 |
# File 'lib/slack_bot_server/remote_control.rb', line 30 def broadcast(key, ) @queue.push([:broadcast, key, ]) end |
#call(key, method, args) ⇒ Object
Sends a message to be called directly on the slack web API. Generally for debugging only.
57 58 59 |
# File 'lib/slack_bot_server/remote_control.rb', line 57 def call(key, method, args) @queue.push([:call, [key, method, args]]) end |
#remove_bot(key) ⇒ Object
Sends a remove_bot
command to the server.
22 23 24 |
# File 'lib/slack_bot_server/remote_control.rb', line 22 def remove_bot(key) @queue.push([:remove_bot, key]) end |
#say(key, message_data) ⇒ Object
Sends an say
command to the server.
38 39 40 |
# File 'lib/slack_bot_server/remote_control.rb', line 38 def say(key, ) @queue.push([:say, key, ]) end |
#say_to(key, user_id, message_data) ⇒ Object
Sends an say_to
command to the server.
48 49 50 |
# File 'lib/slack_bot_server/remote_control.rb', line 48 def say_to(key, user_id, ) @queue.push([:say_to, key, user_id, ]) end |