From a56dc0877661f4f6ed85024363fe2ea2e881f687 Mon Sep 17 00:00:00 2001 From: Matthias H Date: Fri, 21 Feb 2014 00:59:30 +0100 Subject: [PATCH] [plugin] tube removed --- data/rbot/plugins/tube.rb | 59 --------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 data/rbot/plugins/tube.rb diff --git a/data/rbot/plugins/tube.rb b/data/rbot/plugins/tube.rb deleted file mode 100644 index bbae5c59..00000000 --- a/data/rbot/plugins/tube.rb +++ /dev/null @@ -1,59 +0,0 @@ -#Tube Status Enquiry plugin for rbot -#Plugin by Colm Linehan - -class TubePlugin < Plugin - def help(plugin, topic="") - "tube [district|circle|metropolitan|central|jubilee|bakerloo|waterlooandcity|hammersmithandcity|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 tube(m, params) - line = params[:line] - tube_page = @bot.httputil.get('http://www.tfl.gov.uk/tfl/livetravelnews/realtime/tube/default.html') - unless tube_page - m.reply "Cannot contact Tube Service Status page" - return - end - next_line = false - tube_page.each_line {|l| - next if l == "\r\n" - next if l == "\n" - if (next_line) - if (l =~ /^

\s*(.*)<\/p>/i) - m.reply $1.split(/<[^>]+>| /i).join(" ") - return - elsif l =~ /ul|h3|"message"/ - next - else - m.reply "There are problems on the #{line} line, but I didn't understand the page format. You should check out http://www.tfl.gov.uk/tfl/livetravelnews/realtime/tube/default.html for more details." - return - end - end - next_line = true if (l =~ /li class="#{line}"/i) - } - m.reply "No Problems on the #{line} line." - end - - def check_stations(m, params) - tube_page = @bot.httputil.get('http://www.tfl.gov.uk/tfl/service_rt_tube.shtml') - unless tube_page - m.reply "Cannot contact Tube Service Status page" - return - end - stations_array = Array.new - tube_page.each_line {|l| - if (l =~ / (.*)<\/b><\/td><\/tr>\s*/i) - stations_array.push $1 - end - } - if stations_array.empty? - m.reply "There are no station-specific announcements" - return - else - m.reply stations_array.join(", ") - return - end - end -end -plugin = TubePlugin.new -# plugin.map 'tube stations', :action => 'check_stations' -plugin.map 'tube :line' -- 2.39.2