ruboty-tweetstream 0.0.2 → 0.0.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/README.md +14 -1
- data/lib/ruboty/tweetstream/stream.rb +13 -2
- data/lib/ruboty/tweetstream/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a6c74e08390f08c9dc6d19475b478b419bc2c3d
|
4
|
+
data.tar.gz: ce85993be83303e4ad8cff5173822695b63aac58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0c58a8e19a54f3668fb48513c7d5998db368d014dc8845b163ab9c40a225666d70155b3b2c4b33325f644276832d1ec2f9d162b89073b0415806a3b688dce11
|
7
|
+
data.tar.gz: a3c587aa48b6fff6e7ff1120a6872195cdf2a500cf85066f81da18004522a03d2dc1d4c231da8f7871b5c0e18cec382cb1dc9effddda723040afe7cdeb8bc19e
|
data/README.md
CHANGED
@@ -26,7 +26,20 @@ gem 'ruboty-tweetstream'
|
|
26
26
|
@kaihar4> テスト1
|
27
27
|
@kaihar4> テスト2
|
28
28
|
> @ruboty list ts
|
29
|
-
@kaihar4
|
29
|
+
@kaihar4
|
30
30
|
> @ruboty delete ts @kaihar4
|
31
31
|
'@kaihar4' stream is stopped.
|
32
32
|
```
|
33
|
+
|
34
|
+
## Setup
|
35
|
+
|
36
|
+
Ruboty::Tweetstream requires access tokens.
|
37
|
+
|
38
|
+
Please get from [Here](https://apps.twitter.com/).
|
39
|
+
|
40
|
+
```
|
41
|
+
export CONSUMER_KEY=
|
42
|
+
export CONSUMER_SECRET=
|
43
|
+
export ACCESS_TOKEN=
|
44
|
+
export ACCESS_TOKEN_SECRET=
|
45
|
+
```
|
@@ -1,3 +1,14 @@
|
|
1
|
+
require 'twitter'
|
2
|
+
|
3
|
+
module Twitter
|
4
|
+
class Tweet
|
5
|
+
def is_pure_user_tweet?(username)
|
6
|
+
self.in_reply_to_screen_name.nil? &&\
|
7
|
+
!self.full_text.include?("@#{username}")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
1
12
|
module Ruboty
|
2
13
|
module Tweetstream
|
3
14
|
class Stream
|
@@ -17,10 +28,10 @@ module Ruboty
|
|
17
28
|
def start(robot)
|
18
29
|
@thread = Thread.start do
|
19
30
|
@client.filter(follow: hash[:id].to_s) do |object|
|
20
|
-
if object.is_a?(Twitter::Tweet) && object.
|
31
|
+
if object.is_a?(Twitter::Tweet) && object.is_pure_user_tweet?(hash[:username])
|
21
32
|
Message.new(
|
22
33
|
hash.except(:username, :id).merge(robot: robot)
|
23
|
-
).reply("@#{hash[:username]}> #{object.
|
34
|
+
).reply("@#{hash[:username]}> #{object.full_text}")
|
24
35
|
end
|
25
36
|
end
|
26
37
|
end
|