From 22ab8d74d0287df3d1a0971d31055fc7c4cddeac Mon Sep 17 00:00:00 2001 From: Daniel Muckerman Date: Tue, 5 Apr 2016 16:10:48 -0400 Subject: [PATCH] Revert failed April Fool's Day joke This reverts commit f8eec3523aa8786853734d2c4f3b2c2c205a1363. --- Gemfile | 1 - Gemfile.lock | 2 -- slack-pixiv.rb | 1 - slack-pixiv/commands/pixiv.rb | 22 ++-------------------- 4 files changed, 2 insertions(+), 24 deletions(-) diff --git a/Gemfile b/Gemfile index 5ef7fde..e6d6151 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,6 @@ gem 'wolfram' gem 'puma' gem 'sinatra' gem 'mechanize' -gem 'xml-simple' gem 'nokogiri' group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index bfa885c..be001f1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -107,7 +107,6 @@ GEM websocket-extensions (0.1.2) wolfram (0.2.1) nokogiri (>= 1.4.3) - xml-simple (1.1.5) PLATFORMS ruby @@ -123,7 +122,6 @@ DEPENDENCIES sinatra slack-ruby-bot (~> 0.6.0) wolfram - xml-simple BUNDLED WITH 1.11.2 diff --git a/slack-pixiv.rb b/slack-pixiv.rb index 443f759..860f370 100644 --- a/slack-pixiv.rb +++ b/slack-pixiv.rb @@ -1,7 +1,6 @@ require 'slack-ruby-bot' require 'wolfram' require 'mechanize' -require 'xmlsimple' require 'nokogiri' require 'slack-pixiv/commands/pixiv' require 'slack-pixiv/app' diff --git a/slack-pixiv/commands/pixiv.rb b/slack-pixiv/commands/pixiv.rb index dd6c481..4ded290 100644 --- a/slack-pixiv/commands/pixiv.rb +++ b/slack-pixiv/commands/pixiv.rb @@ -7,9 +7,6 @@ module SlackMathbot # Initalize Mechanize agent = Mechanize.new - # Get time - time = Time.now - # Create Pixiv URL pixiv_url = "http://www.pixiv.net" + _match[:url][0..-2] puts pixiv_url @@ -30,23 +27,8 @@ module SlackMathbot puts title # Scrape image - r = Range.new( - Time.local(time.year, time.month, time.day, 12), - Time.local(time.year, time.month, time.day, 20) - ) === time - - if ((Date.today.to_s == "2016-04-01") && (r)) - api_url = "http://rule34.paheal.net/api/danbooru/find_posts/index.xml" - - agent.get(api_url) - xml = agent.current_page.body - status = XmlSimple.xml_in(xml) - image_url = status["post"].sample["file_url"] - puts agent.get(pixiv_url).images_with(:src => /600x600\/img-master/)[0].to_s.sub! '600x600','480x960' - else - image_url = agent.get(pixiv_url).images_with(:src => /600x600\/img-master/)[0].to_s.sub! '600x600','480x960' - puts image_url - end + image_url = agent.get(pixiv_url).images_with(:src => /600x600\/img-master/)[0].to_s.sub! '600x600','480x960' + puts image_url client.web_client.chat_postMessage( channel: _data.channel,