Class: SlackBotServer::RemoteControl

Inherits:
Object
  • Object
show all
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

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_token(token) ⇒ Object



12
13
14
# File 'lib/slack_bot_server/remote_control.rb', line 12

def add_token(token)
  @queue.push([:add_token, token])
end

#broadcast(key, message_data) ⇒ Object



20
21
22
# File 'lib/slack_bot_server/remote_control.rb', line 20

def broadcast(key, message_data)
  @queue.push([:broadcast, key, message_data])
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, message_data)
  @queue.push([:say, key, message_data])
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, message_data)
  @queue.push([:say_to, key, user_id, message_data])
end