summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Gerus <arachnist@i.am-a.cat>2015-04-15 21:15:02 +0200
committerRobert Gerus <arachnist@i.am-a.cat>2015-04-15 21:15:02 +0200
commitd5d6f7f12a1235ae5d5649978e0b53d4482be08b (patch)
tree82e345af659a83d416142a11f2578192de780750
parent196d57ffd795716acb9a965ddb394cb1b1922e2b (diff)
downloadrepost-d5d6f7f12a1235ae5d5649978e0b53d4482be08b.tar.gz
repost-d5d6f7f12a1235ae5d5649978e0b53d4482be08b.tar.bz2
repost-d5d6f7f12a1235ae5d5649978e0b53d4482be08b.tar.xz
repost-d5d6f7f12a1235ae5d5649978e0b53d4482be08b.zip
Bombs away
-rw-r--r--plugins/commands/at.rb10
-rw-r--r--plugins/commands/cycki.rb4
-rw-r--r--plugins/commands/gentoo-bugs.rb4
-rw-r--r--plugins/commands/jan.rb12
-rw-r--r--plugins/commands/kotki.rb2
-rw-r--r--plugins/commands/papiez.rb8
-rw-r--r--plugins/commands/sjp.rb2
7 files changed, 21 insertions, 21 deletions
diff --git a/plugins/commands/at.rb b/plugins/commands/at.rb
index df3d460..7982f4f 100644
--- a/plugins/commands/at.rb
+++ b/plugins/commands/at.rb
@@ -6,7 +6,7 @@ Client.register_command("at") { |args|
now = []
recently = []
r_msg = ""
- h = JSON.parse(Net::HTTP.get(URI(Config[:commands][:at][:url])))
+ h = JSON.parse(Net::HTTP.get(URI(Config.lookup("commands::at::url"))))
h["users"].each { |u|
if (Time.now.to_i - u["timestamp"]) > 600 then
recently << u["login"]
@@ -15,10 +15,10 @@ Client.register_command("at") { |args|
end
}
- r_msg += "now: #{now.join(' ')}#{Config[:commands][:at][:separator]} " if not now.empty?
- r_msg += "recently: #{recently.join(' ')}#{Config[:commands][:at][:separator]} " if not recently.empty?
- r_msg += Config[:commands][:at][:empty] if now.empty? and recently.empty?
- r_msg += "unknown: #{h["unknown"]}#{Config[:commands][:at][:separator]} " if h["unknown"] > 0
+ r_msg += "now: #{now.join(' ')}#{Config.lookup("commands::at::separator")} " if not now.empty?
+ r_msg += "recently: #{recently.join(' ')}#{Config.lookup("commands::at::separator")} " if not recently.empty?
+ r_msg += Config.lookup("commands::at::empty") if now.empty? and recently.empty?
+ r_msg += "unknown: #{h:"unknown"}#{Config.lookup("commands::at::separator")} " if h:"unknown" > 0
r_msg
}
diff --git a/plugins/commands/cycki.rb b/plugins/commands/cycki.rb
index 77fd612..c0becd9 100644
--- a/plugins/commands/cycki.rb
+++ b/plugins/commands/cycki.rb
@@ -4,7 +4,7 @@ require 'nokogiri'
Client.register_command("cycki") { |args|
link = ""
begin
- link = Nokogiri::HTML(Net::HTTP.get(URI(Config[:commands][:cycki][:url]))).xpath('//img/@src').inner_text.gsub("_preview", "")
+ link = Nokogiri::HTML(Net::HTTP.get(URI(Config.lookup("commands::cycki::url")))).xpath('//img/@src').inner_text.gsub("_preview", "")
end while link !~ /http/
- Config[:commands][:cycki][:message] + link
+ Config.lookup("commands::cycki::message") + link
}
diff --git a/plugins/commands/gentoo-bugs.rb b/plugins/commands/gentoo-bugs.rb
index 0cc7a14..5cb0126 100644
--- a/plugins/commands/gentoo-bugs.rb
+++ b/plugins/commands/gentoo-bugs.rb
@@ -3,8 +3,8 @@ require 'nokogiri'
Client.register_command("bug") { |args|
if args[0] =~ /^[0-9]+$/ then
- doc = Nokogiri::HTML(Net::HTTP.get(URI(Config[:commands][:bug][:url] + args[0])))
- [Config[:commands][:bug][:url] + args[0], doc.title().delete!('\n'),
+ doc = Nokogiri::HTML(Net::HTTP.get(URI(Config.lookup("commands::bug::url") + args:0)))
+ :Config.lookup("commands::bug::url") + args:0, doc.title().delete!('\n'),
doc.xpath('//span[@id="static_bug_status"]').inner_text.split,
doc.xpath('//td[@id="field_container_product"]').inner_text,
].join('; ')
diff --git a/plugins/commands/jan.rb b/plugins/commands/jan.rb
index dc6cf13..db56982 100644
--- a/plugins/commands/jan.rb
+++ b/plugins/commands/jan.rb
@@ -2,20 +2,20 @@ Client.register_command("jan") { |args|
if not args[0].nil? then
if args[0].force_encoding("UTF-8") =~ /ł$/ then
predicate = args[0]
- object = File.readlines(Config[:commands][:jan][:object]).sample.strip
+ object = File.readlines(Config.lookup("commands::jan::object")).sample.strip
else
- predicate = File.readlines(Config[:commands][:jan][:predicates]).sample.strip
+ predicate = File.readlines(Config.lookup("commands::jan::predicates")).sample.strip
object = args[0]
end
else
- object = File.readlines(Config[:commands][:jan][:object]).sample.strip
- predicate = File.readlines(Config[:commands][:jan][:predicates]).sample.strip
+ object = File.readlines(Config.lookup("commands::jan::object")).sample.strip
+ predicate = File.readlines(Config.lookup("commands::jan::predicates")).sample.strip
end
[
- Config[:commands][:jan][:subject],
+ Config.lookup("commands::jan::subject,")
predicate,
- Config[:commands][:jan][:attribute],
+ Config.lookup("commands::jan::attribute,")
object
].join " "
}
diff --git a/plugins/commands/kotki.rb b/plugins/commands/kotki.rb
index 0c144fd..ffcd407 100644
--- a/plugins/commands/kotki.rb
+++ b/plugins/commands/kotki.rb
@@ -2,7 +2,7 @@ require 'net/http'
require 'uri'
Client.register_command("kotki") { |args|
- url = URI.parse(Config[:commands][:kotki][:url])
+ url = URI.parse(Config.lookup("commands::kotki::url"))
req = Net::HTTP::Get.new(url.path)
response = Net::HTTP.start(url.host, url.port) { |http| http.request(req) }
diff --git a/plugins/commands/papiez.rb b/plugins/commands/papiez.rb
index 89b51fe..3c534d3 100644
--- a/plugins/commands/papiez.rb
+++ b/plugins/commands/papiez.rb
@@ -1,8 +1,8 @@
Client.register_command("papież") { |args|
- Config[:commands][:papiez][:noun] + " " +
- File.readlines(Config[:commands][:papiez][:adjectives]).sample
+ Config.lookup("commands::papiez::noun") + " " +
+ File.readlines(Config.lookup("commands::papiez::adjectives")).sample
}
Client.register_command("papiez") { |args|
- Config[:commands][:papiez][:noun] + " " +
- File.readlines(Config[:commands][:papiez][:adjectives]).sample
+ Config.lookup("commands::papiez::noun") + " " +
+ File.readlines(Config.lookup("commands::papiez::adjectives")).sample
}
diff --git a/plugins/commands/sjp.rb b/plugins/commands/sjp.rb
index a4dd508..6ccd023 100644
--- a/plugins/commands/sjp.rb
+++ b/plugins/commands/sjp.rb
@@ -2,6 +2,6 @@ require 'net/http'
require 'nokogiri'
Client.register_command("sjp") { |args|
- doc = Nokogiri::HTML(Net::HTTP.get(URI(Config[:commands][:sjp][:url] + args[0])))
+ doc = Nokogiri::HTML(Net::HTTP.get(URI(Config.lookup("commands::sjp::url") + args:0)))
doc.xpath('//ul[@id="listahasel"]/li/div/div').inner_text
}