reddit_bot 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/yayornay/main.rb +5 -4
- data/lib/reddit_bot.rb +3 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aea3d07e9510bd5c41964c9bc75067ebc90ba4e
|
4
|
+
data.tar.gz: 7ac6560136ee35dfcf5e275bfe5c8285d681e71a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07f4ebc133019136ba82c9dfa410e9eeefa642e78ccb16e0bcca61830e2fb628f36d96c7631e4801e9589fd532f551bde508e89f8716b00e6acadf07e8bb1200
|
7
|
+
data.tar.gz: 198430df97f9d699f3f400b7013627f8c4c31023b77ac96426fbb9065a419dc2e84dad299028ecf2f8907c48b142124a7aadd7d4f12e10683308d86d76482ea6
|
data/examples/yayornay/main.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative "../boilerplate"
|
2
2
|
|
3
|
-
SUBREDDIT = "test___________"
|
4
|
-
|
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"][
|
18
|
-
nay |= [comment["author"]] if comment["body"][
|
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.
|
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:
|
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.
|
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-
|
11
|
+
date: 2016-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|