Skip to content

Commit

Permalink
stopping the bot by a PM
Browse files Browse the repository at this point in the history
  • Loading branch information
Nakilon committed Sep 2, 2020
1 parent b293553 commit bda9f7d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/dut/Gemfile.lock
Expand Up @@ -3,11 +3,11 @@ GEM
specs:
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
json (2.3.0)
json (2.3.1)
nethttputils (0.4.0.0)
addressable
public_suffix (4.0.5)
reddit_bot (1.7.5)
reddit_bot (1.7.6)
json
nethttputils (~> 0.4.0.0)

Expand Down
5 changes: 5 additions & 0 deletions examples/dut/main.rb
Expand Up @@ -4,6 +4,11 @@
twitter = RedditBot::Twitter.init_twitter "DUT_Tweets"

loop do
bot.json(:get, "/message/unread")["data"]["children"].each do |msg|
next unless %w{ nakilon technomod }.include? msg["data"]["author"]
abort "ordered to die" if %w{ die die } == msg["data"].values_at("subject", "body")
end

id = bot.new_posts.find do |post|
/\(https:\/\/twitter\.com\/#{RedditBot::Twitter::TWITTER_ACCOUNT}\/status\/(\d{18,})\)/i =~ post["selftext"] and break $1
end.to_i
Expand Down
4 changes: 2 additions & 2 deletions examples/unisa/Gemfile.lock
Expand Up @@ -4,11 +4,11 @@ GEM
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
byebug (11.0.1)
json (2.3.0)
json (2.3.1)
nethttputils (0.4.0.0)
addressable
public_suffix (4.0.5)
reddit_bot (1.7.5)
reddit_bot (1.7.6)
json
nethttputils (~> 0.4.0.0)

Expand Down
5 changes: 5 additions & 0 deletions examples/unisa/main.rb
Expand Up @@ -4,6 +4,11 @@
twitter = RedditBot::Twitter.init_twitter "unisa"

loop do
bot.json(:get, "/message/unread")["data"]["children"].each do |msg|
next unless %w{ nakilon technomod }.include? msg["data"]["author"]
abort "ordered to die" if %w{ die die } == msg["data"].values_at("subject", "body")
end

id = bot.new_posts.find do |post|
/\(https:\/\/twitter\.com\/#{RedditBot::Twitter::TWITTER_ACCOUNT}\/status\/(\d{18,})\)/i =~ post["selftext"] and break $1
end.to_i
Expand Down

0 comments on commit bda9f7d

Please sign in to comment.