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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29bd178310f09e497ba17e74419960644e44cabd
4
- data.tar.gz: 74366336ea39592f1cee2f977e32d8d38cb9dc61
3
+ metadata.gz: 043b3057a21f6d84396e6c3734011858829c2384
4
+ data.tar.gz: d3fb04c0eb022c732ccec74557d55fc2f96c06dd
5
5
  SHA512:
6
- metadata.gz: 871eeaba13d8348e75f6b95995d496c81d892f6feb1d12f8d40d590d6bd9748d0dd926f439bbcec9c705a32e5346b09133116ec265029e0de609e15def3e687f
7
- data.tar.gz: f490281f500512607a9e6d617e5f48e2df9a7f1d63db9dbeadef2e47cb75eb3dc5152fc53b9355a630e7928be6e351661ae5187a272d2c678b384655e94988e7
6
+ metadata.gz: 81126a16a437d183556368bad98e01ee9ffec447a5388e7558eeab448daf424baf1adb58895d03c2f8af8777e96296018bf7b77a8917be4bb18bd4a4c78bc25b
7
+ data.tar.gz: 57cfaa77cf77442c22c8433b5241e2a4421f4c7de5a5e7f1275a99f7abcc9b7ecdaa3c5a024764fdbbcc5786080d66e713c7fbb381d639560b278b1152daebbe
@@ -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)
@@ -63,6 +63,12 @@ module Slacks
63
63
  end
64
64
  end
65
65
 
66
+ def reaction_added(data)
67
+ end
68
+
69
+ def reaction_removed(data)
70
+ end
71
+
66
72
  protected
67
73
 
68
74
  def invoke!(listener, event)
@@ -1,3 +1,3 @@
1
1
  module Slacks
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
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.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-12 00:00:00.000000000 Z
11
+ date: 2016-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket-driver