summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/tube.rb
diff options
context:
space:
mode:
authorTom Gilbert <tom@linuxbrit.co.uk>2005-07-29 13:44:33 +0000
committerTom Gilbert <tom@linuxbrit.co.uk>2005-07-29 13:44:33 +0000
commit676dd61e6b0bea5f506d064039a685944aefd6fb (patch)
tree60fa1936a11a67d6412f9db28532d623aabed5d1 /data/rbot/plugins/tube.rb
parent438d56ceb82755961229d222d82a1c22ce04ab1d (diff)
Fri Jul 29 13:07:56 BST 2005 Tom Gilbert <tom@linuxbrit.co.uk>
* Moved some stuff out of util.rb into the plugins that actually need them. Those methods didn't belong in util as they were plugin-specific. * moved a few more plugins to use map() where appropriate * made the url plugin only store unique urls
Diffstat (limited to 'data/rbot/plugins/tube.rb')
-rw-r--r--data/rbot/plugins/tube.rb16
1 files changed, 5 insertions, 11 deletions
diff --git a/data/rbot/plugins/tube.rb b/data/rbot/plugins/tube.rb
index 77ca5227..85316718 100644
--- a/data/rbot/plugins/tube.rb
+++ b/data/rbot/plugins/tube.rb
@@ -9,16 +9,9 @@ class TubePlugin < Plugin
def help(plugin, topic="")
"tube [district|circle|metropolitan|central|jubilee|bakerloo|waterloo_city|hammersmith_city|victoria|eastlondon|northern|piccadilly] => display tube service status for the specified line(Docklands Light Railway is not currently supported), tube stations => list tube stations (not lines) with problems"
end
- def privmsg(m)
- if m.params && m.params =~ /^stations$/
- check_stations m
- elsif m.params && m.params =~ /^(.*)$/
- line = $1.downcase.capitalize
- check_tube m, line
- end
- end
- def check_tube(m, line)
+ def tube(m, params)
+ line = params[:line]
begin
tube_page = @bot.httputil.get(URI.parse("http://www.tfl.gov.uk/tfl/service_rt_tube.shtml"), 1, 1)
rescue URI::InvalidURIError, URI::BadURIError => e
@@ -47,7 +40,7 @@ class TubePlugin < Plugin
m.reply "No Problems on the #{line} line."
end
- def check_stations(m)
+ def check_stations(m, params)
begin
tube_page = @bot.httputil.get(URI.parse("http://www.tfl.gov.uk/tfl/service_rt_tube.shtml"))
rescue URI::InvalidURIError, URI::BadURIError => e
@@ -74,4 +67,5 @@ class TubePlugin < Plugin
end
end
plugin = TubePlugin.new
-plugin.register("tube")
+plugin.map 'tube stations', :action => 'check_stations'
+plugin.map 'tube :line'