slack_twitter_egosa 1.0.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: 163a699d485f9c986265105fceb48ca8af2fa95746e5bf09a01d1877b319d004
4
- data.tar.gz: 967c8cedd7af22e47b02c8b743a130decf08e8c4cab0fe6f954e9f6fa216e240
3
+ metadata.gz: 29778afe377a8db542357e0eb4cacd6ab80c667aa6b17fa8895402715f0ded4f
4
+ data.tar.gz: 0a39834684074683e53032810ff42f5981a5ac77cc15c393b03306ec464c94ea
5
5
  SHA512:
6
- metadata.gz: aa2c25f3ff9c777a5952b681066039891082972fda176450e662c65e5267bc91ca670db8a04cd87b6a35f130f4b9ebb6d51ea0af6e8f650bd735f8d4a7614110
7
- data.tar.gz: f04bd596287ecb0a5ed5690c6bc004b8cfec27fca76e27ac651a1a9fb3221764c69149aa0d6eae70fb01e3604b53775864f6400f84958e11632eae942cab284b
6
+ metadata.gz: 986c970b1875535bfda7c3548c439152242a650c921e3fe99a0e8cdfa465473061c7eeffaa3e01d06a2b28c00149096946938a803d8ffe345e35c6386dca8d2a
7
+ data.tar.gz: a83fd222bbdd8e441f50d923fa14e58441f8f53dc835d5c3d5e71419b4301243feed1c38a7ed667d50233234553f4ced0b6aa74105b7716f4e664d4e3a86baed
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  slack-twitter-egosa
2
2
  ===
3
3
 
4
- [![Build Status](https://travis-ci.org/ABCanG/slack-twitter-egosa.svg?branch=master)](https://travis-ci.org/ABCanG/slack-twitter-egosa)
4
+ [![Build Status](https://travis-ci.org/abcang/slack-twitter-egosa.svg?branch=master)](https://travis-ci.org/abcang/slack-twitter-egosa)
5
5
  [![Gem Version](https://badge.fury.io/rb/slack_twitter_egosa.svg)](https://badge.fury.io/rb/slack_twitter_egosa)
6
6
  [![](https://images.microbadger.com/badges/version/abcang/slack-twitter-egosa.svg)](http://microbadger.com/images/abcang/slack-twitter-egosa "Get your own version badge on microbadger.com")
7
7
 
@@ -60,7 +60,9 @@ docker run \
60
60
  * 2016/08/23: 公開
61
61
  * 2016/09/20: ミュートユーザ、除外キーワード機能を追加
62
62
  * 2016/09/22: 除外キーワードバグの修正、gemで公開、大文字小文字を区別しないようにした
63
- * 2018/05/21: ストリーミングAPIを使わないように変更(90秒に1回REST APIを叩く)
63
+ * 2018/05/21: 1.0.0 ストリーミングAPIを使わないように変更(90秒に1回REST APIを叩く)
64
+ * 検索用の環境変数を変更しました
65
+ * 2018/05/22: 1.0.1 full_textを使用するように変更
64
66
 
65
67
  ## ライセンス
66
68
  MIT
@@ -71,12 +71,12 @@ module SlackTwitterEgosa
71
71
  return false if status.user.following?
72
72
  end
73
73
 
74
- mute_users.unmatch?(status.user.screen_name) && home_timeline_words.match?(CGI.unescapeHTML(status.full_text))
74
+ mute_users.unmatch?(status.user.screen_name) && home_timeline_words.match?(CGI.unescapeHTML(status.attrs[:full_text]))
75
75
  end
76
76
 
77
77
  def match_on_search?(status)
78
78
  !status.retweet? && mute_users.unmatch?(status.user.screen_name) &&
79
- search_words.unmatch_exclude?(CGI.unescapeHTML(status.full_text))
79
+ search_words.unmatch_exclude?(CGI.unescapeHTML(status.attrs[:full_text]))
80
80
  end
81
81
 
82
82
  def home_timeline_thread
@@ -84,7 +84,7 @@ module SlackTwitterEgosa
84
84
  loop do
85
85
  sleep 90 if @home_timeline_since_id
86
86
 
87
- params = { count: 200 }
87
+ params = { count: 200, tweet_mode: 'extended' }
88
88
  params[:since_id] = @home_timeline_since_id if @home_timeline_since_id
89
89
  statuses = client.home_timeline(params)
90
90
  next if statuses.empty?
@@ -105,10 +105,9 @@ module SlackTwitterEgosa
105
105
  loop do
106
106
  sleep 90 if @search_since_id
107
107
 
108
- params = { result_type: 'recent', count: 100 }
108
+ params = { result_type: 'recent', count: 100, tweet_mode: 'extended' }
109
109
  params[:since_id] = @search_since_id if @search_since_id
110
- q = search_words.target.join(' OR ') + ' ' + search_words.exclude.map { |word| "-#{word}" }.join(' ')
111
- statuses = client.search(q, params).to_a
110
+ statuses = client.search(search_words.query, params).to_a
112
111
  next if statuses.empty?
113
112
 
114
113
  before_search_since_id = @search_since_id
@@ -12,7 +12,7 @@ class SlackPoster
12
12
  unless pushed?(status.id)
13
13
  @poster.icon_url = status.user.profile_image_url
14
14
  @poster.username = "#{status.user.name}(@#{status.user.screen_name})"
15
- @poster.send_message("#{status.full_text}\n#{status.url}")
15
+ @poster.send_message("#{status.attrs[:full_text]}\n#{status.url}")
16
16
  push(status.id)
17
17
  end
18
18
  end
@@ -1,3 +1,3 @@
1
1
  module SlackTwitterEgosa
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
@@ -14,6 +14,13 @@ class WordManager
14
14
  end
15
15
  end
16
16
 
17
+ def query
18
+ [
19
+ target.join(' OR '),
20
+ exclude.map { |word| "-#{word}" }.join(' ')
21
+ ].join(' ')
22
+ end
23
+
17
24
  def match?(text)
18
25
  match_target?(text) && unmatch_exclude?(text)
19
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack_twitter_egosa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - abcang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-21 00:00:00.000000000 Z
11
+ date: 2018-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv