1 # Security threat level plugin for rbot
2 # by Robin Kearney (robin@riviera.org.uk)
4 # inspired by elliots fascination with the us
7 # again a dirty hack but it works, just...
12 class ThreatPlugin < Plugin
14 def help(plugin, topic="")
15 "threat => prints out the current threat level as reported by http://www.dhs.gov/"
20 red = "\x0304" # severe
21 orange = "\x0307" # high
22 yellow = "\x0308" # elevated
23 blue = "\x0312" # guarded
24 green = "\x0303" # low
25 black = "\x0301" # default
27 page = @bot.httputil.get URI.parse("http://www.dhs.gov/")
29 if page =~ /\"Current National Threat Level is (.*?)\"/
46 m.reply color + "Today " + m.sourcenick + " the threat level is " + state.capitalize
48 m.reply "I was unable to retrieve the threat level"
55 plugin = ThreatPlugin.new
56 plugin.register("threat")