ruboty-tweetstream 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 519c862311055965634469a893ad735086af36f9
4
- data.tar.gz: 6453c1bf7f6d47bb77036e1356fd98f531394d1c
3
+ metadata.gz: 6a6c74e08390f08c9dc6d19475b478b419bc2c3d
4
+ data.tar.gz: ce85993be83303e4ad8cff5173822695b63aac58
5
5
  SHA512:
6
- metadata.gz: 9659780620d3ef540382b5b035d7b2ebe5b0fd72e4441ff73f6ec1246ae20c3b6904b516c988be2a78eb29c1a02dcd498a82cbf31b7754cdc78abe56279c6943
7
- data.tar.gz: 5215d7ad056c000baa6482c5e9d5f84123d548b56b6f20903bfc4720ee39638f486e617e56f5e5d63d1476283d8744944c503f6c56df58c2e68389e8bf2e560d
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 -> id:2703995576
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.in_reply_to_screen_name.nil?
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.text}")
34
+ ).reply("@#{hash[:username]}> #{object.full_text}")
24
35
  end
25
36
  end
26
37
  end
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Tweetstream
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-tweetstream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaihar4