bot_mob 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92a808579fe8f0b959bc2612bb063d73e0155b43
4
- data.tar.gz: 8bf08bc4ecc76ab438190964c654d1b15fe6a7d2
3
+ metadata.gz: 3b4ac52b9e58932d7a1f3b67621cc368ed2dbb25
4
+ data.tar.gz: ced498a9261d93c8a3ced4baa47cd4152e8d4ebd
5
5
  SHA512:
6
- metadata.gz: 9ae7d2f8109963d8e0dd9e689191303dc5964a09b0b021de9fcc2c8bc490dda1befd0f66ce7dcb315402c28339d7fe481a902c9d4a475c4f800294d6a0b5965a
7
- data.tar.gz: 25198a5dc2a6032a76459a298f61206791d9d488b5d959aaea237234d381680d6b03ed09b43a7bc3d877839f3a88905b9e3f6ca50a8e65093d680e1f839066e0
6
+ metadata.gz: 321de0b69949d7aac245db16b992272313f6f4c699841b8760658839ab4ec0e8e30c53d8dc6ac0206b4a251f5dc1bd4d36ab860fe40cb78fff69ad4c18dd189f
7
+ data.tar.gz: a1f8864999ec86a775f87a8fb46169da67b86895aa966f36be4c78f0dc280b87ed9224b5db83ace70ce62de7f02b864bc1880b6d4f642880764637e64b7944ee
@@ -18,11 +18,11 @@ module BotMob
18
18
  loop { sleep(10) }
19
19
  end
20
20
 
21
- def add_bot(user_id)
22
- BotMob.logger.info "Adding bot: #{user_id}"
23
- install = Install.find_by_user_id(user_id)
21
+ def add_bot(external_id)
22
+ BotMob.logger.info "Adding bot: #{external_id}"
23
+ install = Install.find_by_external_id(external_id)
24
24
  if install.nil?
25
- BotMob.logger.info "Could not find bot: #{user_id}"
25
+ BotMob.logger.info "Could not find bot: #{external_id}"
26
26
  return
27
27
  end
28
28
 
@@ -30,9 +30,9 @@ module BotMob
30
30
  end
31
31
 
32
32
  def register(install)
33
- bot = bot_class.new(install.user_id, install.token)
34
- @bots[install.user_id] ||= bot
35
- @bots[install.user_id].refresh
33
+ bot = bot_class.new(install.external_id, install.token)
34
+ @bots[install.external_id] ||= bot
35
+ @bots[install.external_id].refresh
36
36
  end
37
37
 
38
38
  private
data/lib/bot_mob/bot.rb CHANGED
@@ -4,10 +4,10 @@ module BotMob
4
4
  # This is the base for all bots that will connect
5
5
  # to Slack.
6
6
  class Bot
7
- attr_reader :user_id, :state
7
+ attr_reader :external_id, :state
8
8
 
9
- def initialize(user_id, token)
10
- @user_id = user_id
9
+ def initialize(external_id, token)
10
+ @external_id = external_id
11
11
 
12
12
  if token.nil?
13
13
  @state = :inactive
@@ -55,7 +55,7 @@ module BotMob
55
55
  when disconnected?
56
56
  reconnect
57
57
  else
58
- logger.info "State[#{user_id}] - No Change"
58
+ logger.info "State[#{external_id}] - No Change"
59
59
  end
60
60
  end
61
61
 
@@ -112,7 +112,7 @@ module BotMob
112
112
  logger.info "Successfully connected, '#{client.team.name}' team at https://#{client.team.domain}.slack.com."
113
113
  end
114
114
 
115
- logger.info "State[#{user_id}] - #{state}"
115
+ logger.info "State[#{external_id}] - #{state}"
116
116
  @state = state
117
117
  end
118
118
 
@@ -5,7 +5,7 @@ module BotMob
5
5
  # messages received from Slack's Real Time API
6
6
  class InboundMessage
7
7
  attr_reader :source, :data, :token, :team_id, :team_domain,
8
- :channel_id, :channel_name, :user_id, :user_name,
8
+ :channel_id, :channel_name, :external_id, :user_name,
9
9
  :command, :text, :bot_id, :response_url, :ts
10
10
 
11
11
  def initialize(source, data)
@@ -33,7 +33,7 @@ module BotMob
33
33
  @bot_id = data[:bot_id]
34
34
  @team = data[:team]
35
35
  @ts = data[:ts]
36
- @user_id = data[:user_id]
36
+ @external_id = data[:user_id]
37
37
  end
38
38
 
39
39
  def parse_webhook(data)
@@ -42,7 +42,7 @@ module BotMob
42
42
  @team_domain = data['team_domain']
43
43
  @channel_id = data['channel_id']
44
44
  @channel_name = data['channel_name']
45
- @user_id = data['user_id']
45
+ @external_id = data['user_id']
46
46
  @user_name = data['user_name']
47
47
  @command = data['command']
48
48
  @text = data['text']
@@ -1,3 +1,3 @@
1
1
  module BotMob
2
- VERSION = '0.1.9'.freeze
2
+ VERSION = '0.1.10'.freeze
3
3
  end
data/lib/bot_mob/wire.rb CHANGED
@@ -12,7 +12,7 @@ module BotMob
12
12
 
13
13
  def connect(app)
14
14
  queue.subscribe do |_info, _props, body|
15
- app.add_bot(JSON.parse(body)['user_id'])
15
+ app.add_bot(JSON.parse(body)['external_id'])
16
16
  end
17
17
  rescue Bunny::PreconditionFailed => e
18
18
  BotMob.logger.info "#{e.channel_close.reply_code}, message: #{e.channel_close.reply_text}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bot_mob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Werner