twitter_ebooks 3.0.0 → 3.0.1

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: 5207fc0b43e38b2aeefa7f995be02cbbdf98f1d2
4
- data.tar.gz: 79dd79c4cfeee86ff9bb20e790f19473156cfbba
3
+ metadata.gz: 3328234bbea5d2c32d76bd94af374cc5df1e85e2
4
+ data.tar.gz: c6657971137b56ba1f0a3edc758d2e467062611d
5
5
  SHA512:
6
- metadata.gz: da424019fae0c0b9383be7fcc1feb80a562f3612c6991f49eeda4dd3864c905ce6e3c0497b85ed001ec2eac7d81d2b92a0fd1271bad8f6c539ad017852e8e11f
7
- data.tar.gz: e332b40106b7dd9df79704e80ee67fe4798458c8cb483f21e1302dd99f3cfa5a1f6dcf3327654e605c13f42884abc67f3eccd30f4475c7a62e2d7ea882bc894f
6
+ metadata.gz: 4ea260cf0fe888cdfa10b7b168ddf4331d51fc835ef85afcaa4f0e6591c56adb25984c1b24a117ef0d2407ca9d78ef22bb80013d4e05db8b1bb35af0c0a9899b
7
+ data.tar.gz: f4eda05cce4092fe8ec37868eaf7ec0dab7b1e1f4c5a2a465dff8b12bc718250a26fbe7282ecce5986a855aaae826c98109accfb0c2375be48dcda916348ebb4
data/README.md CHANGED
@@ -8,13 +8,14 @@ A framework for building interactive twitterbots which respond to mentions/DMs.
8
8
 
9
9
  ## New in 3.0
10
10
 
11
+ - About 80% less memory and storage use for models
11
12
  - Bots run in their own threads (no eventmachine), and startup is parallelized
12
13
  - Bots start with `ebooks start`, and no longer die on unhandled exceptions
13
14
  - `ebooks auth` command will create new access tokens, for running multiple bots
14
15
  - `ebooks console` starts a ruby interpreter with bots loaded (see Ebooks::Bot.all)
15
16
  - Replies are slightly rate-limited to prevent infinite bot convos
16
17
  - Non-participating users in a mention chain will be dropped after a few tweets
17
- - [API documentation](http://rdoc.info/github/mispy/twitter_ebooks)
18
+ - [API documentation](http://rdoc.info/github/mispy/twitter_ebooks) and tests
18
19
 
19
20
  Note that 3.0 is not backwards compatible with 2.x, so upgrade carefully!
20
21
 
@@ -26,7 +26,7 @@ module Ebooks
26
26
  # Make an informed guess as to whether a user is a bot based
27
27
  # on their behavior in this conversation
28
28
  def is_bot?(username)
29
- usertweets = @tweets.select { |t| t.user.screen_name == username }
29
+ usertweets = @tweets.select { |t| t.user.screen_name.downcase == username.downcase }
30
30
 
31
31
  if usertweets.length > 2
32
32
  if (usertweets[-1].created_at - usertweets[-3].created_at) < 30
@@ -41,7 +41,7 @@ module Ebooks
41
41
  # We want to avoid spamming non-participating users
42
42
  def can_include?(username)
43
43
  @tweets.length <= 4 ||
44
- !@tweets[-4..-1].select { |t| t.user.screen_name == username }.empty?
44
+ !@tweets[-4..-1].select { |t| t.user.screen_name.downcase == username.downcase }.empty?
45
45
  end
46
46
  end
47
47
 
@@ -220,18 +220,18 @@ module Ebooks
220
220
  end
221
221
 
222
222
  if ev.is_a? Twitter::DirectMessage
223
- return if ev.sender.screen_name == @username # Don't reply to self
223
+ return if ev.sender.screen_name.downcase == @username.downcase # Don't reply to self
224
224
  log "DM from @#{ev.sender.screen_name}: #{ev.text}"
225
225
  fire(:direct_message, ev)
226
226
 
227
227
  elsif ev.respond_to?(:name) && ev.name == :follow
228
- return if ev.source.screen_name == @username
228
+ return if ev.source.screen_name.downcase == @username.downcase
229
229
  log "Followed by #{ev.source.screen_name}"
230
230
  fire(:follow, ev.source)
231
231
 
232
232
  elsif ev.is_a? Twitter::Tweet
233
233
  return unless ev.text # If it's not a text-containing tweet, ignore it
234
- return if ev.user.screen_name == @username # Ignore our own tweets
234
+ return if ev.user.screen_name.downcase == @username.downcase # Ignore our own tweets
235
235
 
236
236
  meta = meta(ev)
237
237
 
@@ -283,7 +283,13 @@ module Ebooks
283
283
  exit 1
284
284
  end
285
285
 
286
- twitter
286
+ real_name = twitter.user.screen_name
287
+
288
+ if real_name != @username
289
+ log "connected to @#{real_name}-- please update config to match Twitter account name"
290
+ @username = real_name
291
+ end
292
+
287
293
  fire(:startup)
288
294
  end
289
295
 
@@ -318,7 +324,7 @@ module Ebooks
318
324
  # @param username [String]
319
325
  # @return [Boolean]
320
326
  def blacklisted?(username)
321
- if @blacklist.include?(username)
327
+ if @blacklist.map(&:downcase).include?(username.downcase)
322
328
  true
323
329
  else
324
330
  false
@@ -1,3 +1,3 @@
1
1
  module Ebooks
2
- VERSION = "3.0.0"
2
+ VERSION = "3.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter_ebooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaiden Mispy