slacks 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/slacks/connection.rb +7 -0
- data/lib/slacks/observer.rb +1 -0
- data/lib/slacks/version.rb +1 -1
- metadata +2 -3
- data/lib/slacks/conversation.rb +0 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13b663a4b93ab60afdd6b5477986cdfb19a6029b
|
4
|
+
data.tar.gz: 229c1a95b05d4819b019b14e8b2d656bc6aaadfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf36d8430ad6dcd355287d09e3e0aef2854705b3c1cf1c03a31df6855ef71011104dd077eef02d42582761fccf5989dc72580ab94d4c124c988c50746bcbe6c5
|
7
|
+
data.tar.gz: 43250245831f93f211835d01b2b931bf740c08f065eede6b900b87300d5cf0107cdc8b7a14cccb168dd7c5da0629c2ec927cd900e54eb325500f65e5839080b0
|
data/lib/slacks/connection.rb
CHANGED
@@ -109,6 +109,13 @@ module Slacks
|
|
109
109
|
|
110
110
|
websocket.on(:message) do |data|
|
111
111
|
case data["type"]
|
112
|
+
when NilClass
|
113
|
+
# Every event has a `type` property:
|
114
|
+
# https://api.slack.com/rtm#events
|
115
|
+
# If an event comes across without
|
116
|
+
# one, we'll skill it.
|
117
|
+
next
|
118
|
+
|
112
119
|
when EVENT_GROUP_JOINED
|
113
120
|
group = data["channel"]
|
114
121
|
@groups_by_id[group["id"]] = group
|
data/lib/slacks/observer.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.3.
|
4
|
+
version: 0.3.2
|
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-06-
|
11
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket-driver
|
@@ -183,7 +183,6 @@ files:
|
|
183
183
|
- lib/slacks/bot_user.rb
|
184
184
|
- lib/slacks/channel.rb
|
185
185
|
- lib/slacks/connection.rb
|
186
|
-
- lib/slacks/conversation.rb
|
187
186
|
- lib/slacks/core_ext/exception.rb
|
188
187
|
- lib/slacks/driver.rb
|
189
188
|
- lib/slacks/errors.rb
|
data/lib/slacks/conversation.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
require "thread_safe"
|
2
|
-
|
3
|
-
module Slacks
|
4
|
-
class Conversation
|
5
|
-
|
6
|
-
def initialize(session, channel, sender)
|
7
|
-
@session = session
|
8
|
-
raise NotInChannelError, channel if channel.guest?
|
9
|
-
|
10
|
-
@channel = channel
|
11
|
-
@sender = sender
|
12
|
-
@listeners = ThreadSafe::Array.new
|
13
|
-
end
|
14
|
-
|
15
|
-
def listen_for(*args, &block)
|
16
|
-
session.listen_for(*args, &block).tap do |listener|
|
17
|
-
listener.conversation = self
|
18
|
-
listeners.push listener
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def includes?(e)
|
23
|
-
e.channel.id == channel.id && e.sender.id == sender.id
|
24
|
-
end
|
25
|
-
|
26
|
-
def reply(*messages)
|
27
|
-
channel.reply(*messages)
|
28
|
-
end
|
29
|
-
alias :say :reply
|
30
|
-
|
31
|
-
def ask(question, expect: nil)
|
32
|
-
listen_for(*Array(expect)) do |e|
|
33
|
-
e.stop_listening!
|
34
|
-
yield e
|
35
|
-
end
|
36
|
-
|
37
|
-
reply question
|
38
|
-
end
|
39
|
-
|
40
|
-
def end!
|
41
|
-
listeners.each(&:stop_listening!)
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
attr_reader :session, :channel, :sender, :listeners
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|