reddit_bot 1.1.0 → 1.1.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
  SHA1:
3
- metadata.gz: 1f926ac62735d34c52c09633ba7ad9f837c79619
4
- data.tar.gz: 7843372b1f19af4a445db6c5b471b93a3c02d92a
3
+ metadata.gz: 2aea3d07e9510bd5c41964c9bc75067ebc90ba4e
4
+ data.tar.gz: 7ac6560136ee35dfcf5e275bfe5c8285d681e71a
5
5
  SHA512:
6
- metadata.gz: d35ed1deddea26306c5e1877e793e6a8cac4454a74f10195d3a4a345233f8ebffb25997e99976942764790a9dcd996201cd79525c7b29a97d053edab5cd6a49f
7
- data.tar.gz: 683bd66d4eb6cd408799b75a3eb619836f5e44204ce66030cd49baaf76d0ceabfa37f3df87ae75ed803d65dbc34b1036ab2c5d54cd178bb092dc0809edbf11e2
6
+ metadata.gz: 07f4ebc133019136ba82c9dfa410e9eeefa642e78ccb16e0bcca61830e2fb628f36d96c7631e4801e9589fd532f551bde508e89f8716b00e6acadf07e8bb1200
7
+ data.tar.gz: 198430df97f9d699f3f400b7013627f8c4c31023b77ac96426fbb9065a419dc2e84dad299028ecf2f8907c48b142124a7aadd7d4f12e10683308d86d76482ea6
@@ -1,7 +1,7 @@
1
1
  require_relative "../boilerplate"
2
2
 
3
- SUBREDDIT = "test___________"
4
- # SUBREDDIT = "yayornay"
3
+ # SUBREDDIT = "test___________"
4
+ SUBREDDIT = "yayornay"
5
5
 
6
6
  BOT = RedditBot::Bot.new YAML.load(File.read "secrets.yaml"), ignore_captcha: true, subreddit: SUBREDDIT
7
7
 
@@ -14,9 +14,10 @@ loop do
14
14
  yay = []
15
15
  nay = []
16
16
  comments.each do |comment|
17
- yay |= [comment["author"]] if comment["body"][/yay/i]
18
- nay |= [comment["author"]] if comment["body"][/nay/i]
17
+ yay |= [comment["author"]] if comment["body"][/\A\s*yay/i]
18
+ nay |= [comment["author"]] if comment["body"][/\A\s*nay/i]
19
19
  end
20
+ p [post["id"], yay, nay] if ENV["LOGNAME"] == "nakilon"
20
21
  yay, nay = [(yay - nay).size, (nay - yay).size]
21
22
  next if 0 == total = yay + nay
22
23
  proper_class = yay > nay ? "yay" : yay < nay ? "nay" : "none"
data/lib/reddit_bot.rb CHANGED
@@ -8,7 +8,7 @@ require "json"
8
8
 
9
9
 
10
10
  module RedditBot
11
- VERSION = "1.1.0"
11
+ VERSION = "1.1.1"
12
12
 
13
13
  class Bot
14
14
 
@@ -186,16 +186,8 @@ module RedditBot
186
186
  use_ssl: uri.scheme == "https",
187
187
  verify_mode: OpenSSL::SSL::VERIFY_NONE,
188
188
  open_timeout: 300
189
- rescue Errno::ECONNRESET
190
- puts "ERROR: SSL_connect (Errno::ECONNRESET)"
191
- sleep 5
192
- retry
193
- rescue OpenSSL::SSL::SSLError
194
- puts "ERROR: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server session ticket A (OpenSSL::SSL::SSLError)"
195
- sleep 5
196
- retry
197
- rescue Net::OpenTimeout
198
- puts "ERROR: execution expired (Net::OpenTimeout)"
189
+ rescue Errno::ECONNRESET, OpenSSL::SSL::SSLError, Net::OpenTimeout, SocketError => e
190
+ puts "ERROR: #{e.class}: #{e}"
199
191
  sleep 5
200
192
  retry
201
193
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reddit_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Maslov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-06 00:00:00.000000000 Z
11
+ date: 2016-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json