ruboty-slack_rtm 2.7.2 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -0
- data/lib/ruboty/adapters/slack_rtm.rb +12 -3
- data/lib/ruboty/message.rb +9 -0
- data/lib/ruboty/robot.rb +10 -0
- data/lib/ruboty/slack_rtm.rb +2 -0
- data/lib/ruboty/slack_rtm/version.rb +1 -1
- data/ruboty-slack_rtm.gemspec +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9dc29f6cef0ea1e5e3886e70d33f4d9e5731e086f70d39088a995a9367dc27cb
|
4
|
+
data.tar.gz: 128bbc4de539fa9abe0b227fbdc0f152fc66b815cd1c73164215bc11381e350f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: deb25f3219be6672b16552d48aeb855dcffb24a0df7b4ecc97bf489b73f0e3963ae559f26e40fc1b72c8214033922c9498554d5d416eb1507dc05cb76e865c4d
|
7
|
+
data.tar.gz: 7df223ed0d7cfbc57e932a4534a3ff37796db4d67f6d5490d59ddb109ba040279f3d01502013fca31909dc31ef971ad7c5393af94eaad5ab5fbd3ff94acd57c9
|
data/README.md
CHANGED
@@ -16,6 +16,7 @@ gem 'ruboty-slack_rtm'
|
|
16
16
|
- `SLACK_EXPOSE_CHANNEL_NAME`: if this set to 1, `message.to` will be channel name instead of id (optional)
|
17
17
|
- `SLACK_IGNORE_GENERAL`: if this set to 1, bot ignores all messages on #general channel (optional)
|
18
18
|
- `SLACK_GENERAL_NAME`: Set general channel name if your Slack changes general name (optional)
|
19
|
+
- `SLACK_AUTO_RECONNECT`: Enable auto reconnect if rtm disconnected by Slack (optional)
|
19
20
|
|
20
21
|
This adapter doesn't require a real user account. Using with bot integration's API token is recommended.
|
21
22
|
See: https://api.slack.com/bot-users
|
@@ -12,12 +12,12 @@ module Ruboty
|
|
12
12
|
env :SLACK_IGNORE_BOT_MESSAGE, "If this set to 1, bot ignores bot_messages", optional: true
|
13
13
|
env :SLACK_IGNORE_GENERAL, "if this set to 1, bot ignores all messages on #general channel", optional: true
|
14
14
|
env :SLACK_GENERAL_NAME, "Set general channel name if your Slack changes general name", optional: true
|
15
|
+
env :SLACK_AUTO_RECONNECT, "Enable auto reconnect", optional: true
|
15
16
|
|
16
17
|
def run
|
17
18
|
init
|
18
19
|
bind
|
19
20
|
connect
|
20
|
-
# TODO: reconnect
|
21
21
|
end
|
22
22
|
|
23
23
|
def say(message)
|
@@ -47,6 +47,10 @@ module Ruboty
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
+
def add_reaction(reaction, channel_id, timestamp)
|
51
|
+
client.reactions_add(name: reaction, channel: channel_id, timestamp: timestamp)
|
52
|
+
end
|
53
|
+
|
50
54
|
private
|
51
55
|
|
52
56
|
def init
|
@@ -77,12 +81,17 @@ module Ruboty
|
|
77
81
|
end
|
78
82
|
end
|
79
83
|
|
80
|
-
|
84
|
+
loop do
|
85
|
+
realtime.main_loop rescue nil
|
86
|
+
break unless ENV['SLACK_AUTO_RECONNECT']
|
87
|
+
@url = null
|
88
|
+
@realtime = null
|
89
|
+
end
|
81
90
|
end
|
82
91
|
|
83
92
|
def url
|
84
93
|
@url ||= begin
|
85
|
-
response = Net::HTTP.post_form(URI.parse('https://slack.com/api/rtm.
|
94
|
+
response = Net::HTTP.post_form(URI.parse('https://slack.com/api/rtm.connect'), token: ENV['SLACK_TOKEN'])
|
86
95
|
body = JSON.parse(response.body)
|
87
96
|
|
88
97
|
URI.parse(body['url'])
|
data/lib/ruboty/robot.rb
ADDED
data/lib/ruboty/slack_rtm.rb
CHANGED
data/ruboty-slack_rtm.gemspec
CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency 'rubocop', '>= 0.28.0'
|
24
24
|
|
25
25
|
spec.add_dependency 'ruboty', '>= 1.1.4'
|
26
|
-
spec.add_dependency 'slack-api', '~> 1.
|
26
|
+
spec.add_dependency 'slack-api', '~> 1.6'
|
27
27
|
spec.add_dependency 'websocket-client-simple', '~> 0.3.0'
|
28
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-slack_rtm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Kusano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1.
|
75
|
+
version: '1.6'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
82
|
+
version: '1.6'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: websocket-client-simple
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +108,8 @@ files:
|
|
108
108
|
- README.md
|
109
109
|
- Rakefile
|
110
110
|
- lib/ruboty/adapters/slack_rtm.rb
|
111
|
+
- lib/ruboty/message.rb
|
112
|
+
- lib/ruboty/robot.rb
|
111
113
|
- lib/ruboty/slack_rtm.rb
|
112
114
|
- lib/ruboty/slack_rtm/client.rb
|
113
115
|
- lib/ruboty/slack_rtm/version.rb
|
@@ -132,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
134
|
version: '0'
|
133
135
|
requirements: []
|
134
136
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.7.6
|
136
138
|
signing_key:
|
137
139
|
specification_version: 4
|
138
140
|
summary: Slack real time messaging adapter for Ruboty
|