reddit_bot 1.7.7 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reddit_bot.rb +36 -21
- data/reddit_bot.gemspec +9 -11
- metadata +12 -80
- data/.gitignore +0 -5
- data/Gemfile +0 -5
- data/README.md +0 -101
- data/Rakefile +0 -6
- data/examples/.bashrc +0 -2
- data/examples/.gitignore +0 -2
- data/examples/Gemfile.lock +0 -17
- data/examples/boilerplate.rb +0 -12
- data/examples/councilofricks/Gemfile +0 -4
- data/examples/councilofricks/Gemfile.lock +0 -17
- data/examples/councilofricks/main.rb +0 -58
- data/examples/cptflairbot3/.bashrc +0 -1
- data/examples/cptflairbot3/Code.gs +0 -13
- data/examples/cptflairbot3/Gemfile +0 -5
- data/examples/cptflairbot3/Gemfile.lock +0 -74
- data/examples/cptflairbot3/app.js +0 -40
- data/examples/cptflairbot3/casual/casualpokemontrades.htm +0 -910
- data/examples/cptflairbot3/casual/script.js +0 -55
- data/examples/cptflairbot3/casual/style.css +0 -1099
- data/examples/cptflairbot3/log.htm +0 -1
- data/examples/cptflairbot3/main.rb +0 -62
- data/examples/cptflairbot3/package.json +0 -6
- data/examples/cptflairbot3/pubsub.rb +0 -30
- data/examples/cptflairbot3/update_gas_hook_secret.rb +0 -4
- data/examples/devflairbot/Gemfile +0 -6
- data/examples/devflairbot/Gemfile.lock +0 -74
- data/examples/devflairbot/main.rb +0 -81
- data/examples/dut/Gemfile +0 -4
- data/examples/dut/Gemfile.lock +0 -24
- data/examples/dut/main.rb +0 -41
- data/examples/get_dimensions.rb +0 -212
- data/examples/iostroubleshooting/Gemfile +0 -5
- data/examples/iostroubleshooting/Gemfile.lock +0 -16
- data/examples/iostroubleshooting/main.rb +0 -36
- data/examples/johnnymarr/Gemfile +0 -3
- data/examples/johnnymarr/Gemfile.lock +0 -17
- data/examples/johnnymarr/main.rb +0 -54
- data/examples/johnnymarr/twitter.rb +0 -80
- data/examples/largeimages/Gemfile +0 -11
- data/examples/largeimages/Gemfile.lock +0 -105
- data/examples/largeimages/main.rb +0 -173
- data/examples/largeimagesreview/Gemfile +0 -4
- data/examples/largeimagesreview/Gemfile.lock +0 -15
- data/examples/largeimagesreview/main.rb +0 -43
- data/examples/mlgtv/Gemfile +0 -4
- data/examples/mlgtv/Gemfile.lock +0 -23
- data/examples/mlgtv/channels.txt +0 -127
- data/examples/mlgtv/main.rb +0 -160
- data/examples/net_http_utils.rb +0 -148
- data/examples/oneplus/Gemfile +0 -5
- data/examples/oneplus/Gemfile.lock +0 -26
- data/examples/oneplus/main.rb +0 -43
- data/examples/realtimeww2/.bashrc +0 -1
- data/examples/realtimeww2/Gemfile +0 -3
- data/examples/realtimeww2/Gemfile.lock +0 -17
- data/examples/realtimeww2/main.rb +0 -129
- data/examples/sexypizza/Gemfile +0 -3
- data/examples/sexypizza/Gemfile.lock +0 -15
- data/examples/sexypizza/main.rb +0 -33
- data/examples/unisa/Gemfile +0 -4
- data/examples/unisa/Gemfile.lock +0 -24
- data/examples/unisa/main.rb +0 -41
- data/examples/wallpaper/Gemfile +0 -5
- data/examples/wallpaper/Gemfile.lock +0 -34
- data/examples/wallpaper/main.rb +0 -27
- data/examples/yayornay/Gemfile +0 -3
- data/examples/yayornay/Gemfile.lock +0 -15
- data/examples/yayornay/main.rb +0 -33
data/examples/wallpaper/Gemfile
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
addressable (2.7.0)
|
5
|
-
public_suffix (>= 2.0.2, < 5.0)
|
6
|
-
directlink (0.0.8.7)
|
7
|
-
addressable
|
8
|
-
fastimage (~> 2.1.3)
|
9
|
-
kramdown
|
10
|
-
nethttputils (~> 0.3.3.0)
|
11
|
-
nokogiri
|
12
|
-
reddit_bot (~> 1.7.0)
|
13
|
-
fastimage (2.1.7)
|
14
|
-
json (2.3.0)
|
15
|
-
kramdown (2.1.0)
|
16
|
-
mini_portile2 (2.4.0)
|
17
|
-
nethttputils (0.3.3.0)
|
18
|
-
nokogiri (1.10.4)
|
19
|
-
mini_portile2 (~> 2.4.0)
|
20
|
-
public_suffix (2.0.5)
|
21
|
-
reddit_bot (1.7.3)
|
22
|
-
json
|
23
|
-
nethttputils (~> 0.3.3.0)
|
24
|
-
|
25
|
-
PLATFORMS
|
26
|
-
ruby
|
27
|
-
|
28
|
-
DEPENDENCIES
|
29
|
-
directlink
|
30
|
-
nokogiri (~> 1.10.4)
|
31
|
-
public_suffix (< 3.0)
|
32
|
-
|
33
|
-
BUNDLED WITH
|
34
|
-
2.0.2
|
data/examples/wallpaper/main.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require_relative "../boilerplate"
|
2
|
-
|
3
|
-
BOT = RedditBot::Bot.new YAML.load_file "secrets.yaml"
|
4
|
-
SUBREDDIT = "wallpaper"
|
5
|
-
|
6
|
-
require "directlink"
|
7
|
-
|
8
|
-
checked = []
|
9
|
-
loop do
|
10
|
-
puts "LOOP #{Time.now}"
|
11
|
-
|
12
|
-
BOT.json(:get, "/r/#{SUBREDDIT}/new")["data"]["children"].each do |post|
|
13
|
-
id, url, title, subreddit = post["data"].values_at(*%w{ id url title subreddit })
|
14
|
-
next if checked.include? id
|
15
|
-
checked.push id
|
16
|
-
t = DirectLink url
|
17
|
-
(t.is_a?(Array) ? t : [t]).each do |s|
|
18
|
-
resolution = "#{s.width}x#{s.height}"
|
19
|
-
result = title[/\s*\[?#{s.width}\s*[*x×]\s*#{s.height}\]?\s*/i]
|
20
|
-
puts "#{!!result} #{id} [#{resolution}] #{title} #{s.url}"
|
21
|
-
BOT.report "true resolution is #{resolution}", "t3_#{id}" unless result
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
puts "END LOOP #{Time.now}"
|
26
|
-
sleep 60
|
27
|
-
end
|
data/examples/yayornay/Gemfile
DELETED
data/examples/yayornay/main.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require_relative "../boilerplate"
|
2
|
-
|
3
|
-
SUBREDDIT = "yayornay"
|
4
|
-
BOT = RedditBot::Bot.new YAML.load(File.read "secrets.yaml"), subreddit: SUBREDDIT
|
5
|
-
|
6
|
-
loop do
|
7
|
-
puts "LOOP #{Time.now}"
|
8
|
-
|
9
|
-
BOT.each_new_post_with_top_level_comments do |post, comments|
|
10
|
-
yay = []
|
11
|
-
nay = []
|
12
|
-
comments.each do |comment|
|
13
|
-
yay |= [comment["author"]] if comment["body"][/\A\s*yay/i]
|
14
|
-
yay |= [comment["author"]] if comment["body"][/\A\s*yea/i]
|
15
|
-
nay |= [comment["author"]] if comment["body"][/\A\s*nay/i]
|
16
|
-
end
|
17
|
-
p [post["id"], yay, nay] if Gem::Platform.local.os == "darwin"
|
18
|
-
yay, nay = [(yay - nay).size, (nay - yay).size]
|
19
|
-
next if 0 == total = yay + nay
|
20
|
-
proper_class = yay > nay ? "yay" : yay < nay ? "nay" : "none"
|
21
|
-
proper_text = "#{(100 * yay / total).round}% Yay"
|
22
|
-
next if [proper_class, proper_text] == [post["link_flair_css_class"], post["link_flair_text"]]
|
23
|
-
puts "setting #{[proper_class, proper_text]} to #{post["name"]}"
|
24
|
-
if _ = BOT.set_post_flair(post, proper_class, proper_text)
|
25
|
-
fail _.inspect unless _ = {"json"=>{"errors"=>[]}}
|
26
|
-
else
|
27
|
-
# 403
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
puts "END LOOP #{Time.now}"
|
32
|
-
sleep 300
|
33
|
-
end
|