slacks 0.2.2 → 0.2.3
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 +4 -4
- data/lib/slacks/connection.rb +23 -0
- data/lib/slacks/session.rb +6 -0
- data/lib/slacks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 043b3057a21f6d84396e6c3734011858829c2384
|
4
|
+
data.tar.gz: d3fb04c0eb022c732ccec74557d55fc2f96c06dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81126a16a437d183556368bad98e01ee9ffec447a5388e7558eeab448daf424baf1adb58895d03c2f8af8777e96296018bf7b77a8917be4bb18bd4a4c78bc25b
|
7
|
+
data.tar.gz: 57cfaa77cf77442c22c8433b5241e2a4421f4c7de5a5e7f1275a99f7abcc9b7ecdaa3c5a024764fdbbcc5786080d66e713c7fbb381d639560b278b1152daebbe
|
data/lib/slacks/connection.rb
CHANGED
@@ -17,6 +17,8 @@ module Slacks
|
|
17
17
|
EVENT_MESSAGE = "message".freeze
|
18
18
|
EVENT_GROUP_JOINED = "group_joined".freeze
|
19
19
|
EVENT_USER_JOINED = "team_join".freeze
|
20
|
+
EVENT_REACTION_ADDED = "reaction_added".freeze
|
21
|
+
EVENT_REACTION_REMOVED = "reaction_removed".freeze
|
20
22
|
|
21
23
|
def initialize(token, options={})
|
22
24
|
@token = token
|
@@ -48,6 +50,13 @@ module Slacks
|
|
48
50
|
end
|
49
51
|
alias :say :send_message
|
50
52
|
|
53
|
+
def get_message(channel, ts)
|
54
|
+
params = {
|
55
|
+
channel: to_channel_id(channel),
|
56
|
+
timestamp: ts }
|
57
|
+
api("reactions.get", params)
|
58
|
+
end
|
59
|
+
|
51
60
|
def update_message(ts, message, options={})
|
52
61
|
channel = options.fetch(:channel) { raise ArgumentError, "Missing parameter :channel" }
|
53
62
|
attachments = Array(options[:attachments])
|
@@ -106,6 +115,16 @@ module Slacks
|
|
106
115
|
@users_by_id[user["id"]] = user
|
107
116
|
@user_id_by_name[user["name"]] = user["id"]
|
108
117
|
|
118
|
+
when EVENT_REACTION_ADDED
|
119
|
+
# Only care if someone reacted to something the bot said
|
120
|
+
next unless data["item_user"] == bot.id
|
121
|
+
callbacks.reaction_added(data)
|
122
|
+
|
123
|
+
when EVENT_REACTION_REMOVED
|
124
|
+
# Only care if someone reacted to something the bot said
|
125
|
+
next unless data["item_user"] == bot.id
|
126
|
+
callbacks.reaction_removed(data)
|
127
|
+
|
109
128
|
when EVENT_MESSAGE
|
110
129
|
# Don't respond to things that this bot said
|
111
130
|
next if data["user"] == bot.id
|
@@ -157,6 +176,10 @@ module Slacks
|
|
157
176
|
end
|
158
177
|
end
|
159
178
|
|
179
|
+
def find_user_by_nickname(nickname)
|
180
|
+
find_user to_user_id(nickname)
|
181
|
+
end
|
182
|
+
|
160
183
|
|
161
184
|
|
162
185
|
def user_exists?(username)
|
data/lib/slacks/session.rb
CHANGED
data/lib/slacks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slacks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Lail
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket-driver
|