ruboty-tweetstream 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/ruboty/handlers/tweetstream.rb +23 -20
- data/lib/ruboty/tweetstream/stream.rb +2 -2
- data/lib/ruboty/tweetstream/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: 519c862311055965634469a893ad735086af36f9
|
4
|
+
data.tar.gz: 6453c1bf7f6d47bb77036e1356fd98f531394d1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9659780620d3ef540382b5b035d7b2ebe5b0fd72e4441ff73f6ec1246ae20c3b6904b516c988be2a78eb29c1a02dcd498a82cbf31b7754cdc78abe56279c6943
|
7
|
+
data.tar.gz: 5215d7ad056c000baa6482c5e9d5f84123d548b56b6f20903bfc4720ee39638f486e617e56f5e5d63d1476283d8744944c503f6c56df58c2e68389e8bf2e560d
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ module Ruboty
|
|
4
4
|
module Handlers
|
5
5
|
class Tweetstream < Base
|
6
6
|
on /add ts @(?<username>.+)/, name: 'add', description: 'Add a tweetstream'
|
7
|
-
on /list ts/, name: 'list', description: 'Show all tweetstreams'
|
7
|
+
on /list ts\z/, name: 'list', description: 'Show all tweetstreams'
|
8
8
|
on /delete ts @(?<username>.+)/, name: 'delete', description: 'Delete a tweetstream'
|
9
9
|
|
10
10
|
def initialize(*args)
|
@@ -14,17 +14,22 @@ module Ruboty
|
|
14
14
|
|
15
15
|
def add(message)
|
16
16
|
username = message[:username]
|
17
|
-
|
18
|
-
message.
|
19
|
-
|
20
|
-
|
17
|
+
if streams.has_key?(username)
|
18
|
+
message.reply("'@#{username}' stream is already started.")
|
19
|
+
else
|
20
|
+
stream = Ruboty::Tweetstream::Stream.new(
|
21
|
+
message.original.except(:robot).merge(
|
22
|
+
username: username,
|
23
|
+
id: twitter_id(username)
|
24
|
+
)
|
21
25
|
)
|
22
|
-
)
|
23
|
-
stream.start(robot)
|
24
|
-
running_streams[username] = stream
|
25
26
|
|
26
|
-
|
27
|
-
|
27
|
+
stream.start(robot)
|
28
|
+
running_streams[username] = stream
|
29
|
+
|
30
|
+
streams[username] = stream.hash
|
31
|
+
message.reply("'@#{username}' stream is started.")
|
32
|
+
end
|
28
33
|
end
|
29
34
|
|
30
35
|
def delete(message)
|
@@ -41,16 +46,14 @@ module Ruboty
|
|
41
46
|
end
|
42
47
|
|
43
48
|
def list(message)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
message.reply(body)
|
49
|
+
if streams.empty?
|
50
|
+
message.reply("The stream doesn't exist.")
|
51
|
+
else
|
52
|
+
stream_list = streams.map do |username, _hash|
|
53
|
+
"@#{username}"
|
54
|
+
end.join("\t")
|
55
|
+
message.reply(stream_list, code: true)
|
56
|
+
end
|
54
57
|
end
|
55
58
|
|
56
59
|
def restart
|
@@ -17,10 +17,10 @@ module Ruboty
|
|
17
17
|
def start(robot)
|
18
18
|
@thread = Thread.start do
|
19
19
|
@client.filter(follow: hash[:id].to_s) do |object|
|
20
|
-
if object.is_a?(Twitter::Tweet)
|
20
|
+
if object.is_a?(Twitter::Tweet) && object.in_reply_to_screen_name.nil?
|
21
21
|
Message.new(
|
22
22
|
hash.except(:username, :id).merge(robot: robot)
|
23
|
-
).reply("@#{hash[:username]}> #{
|
23
|
+
).reply("@#{hash[:username]}> #{object.text}")
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-tweetstream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaihar4
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruboty
|