diff options
author | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-08-10 23:12:50 +0000 |
---|---|---|
committer | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-08-10 23:12:50 +0000 |
commit | 8db3c907730752ccc668c69080680d1b90140c10 (patch) | |
tree | c080db6ea30f2a923a5ff809682791d558d9f046 | |
parent | 61778ca75f9659c1482284ee0cc56178928044d8 (diff) |
AUTHORS update.
Added two plugins from Robin Kearney <robin@riviera.org.uk>
-rw-r--r-- | AUTHORS | 5 | ||||
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | data/rbot/plugins/bash.rb | 56 | ||||
-rw-r--r-- | data/rbot/plugins/karma.rb | 2 | ||||
-rw-r--r-- | data/rbot/plugins/lart.rb | 2 | ||||
-rw-r--r-- | data/rbot/plugins/threat.rb | 55 |
7 files changed, 130 insertions, 2 deletions
@@ -3,12 +3,17 @@ o Tom Gilbert (giblet) <tom@linuxbrit.co.uk> Patch contributors o Peter Suschlik (pesu) <peter@zilium.de> +o Alexey I. Froloff <raorn@altlinux.ru> +o Ari Pollak <ajp@aripollak.com> +o Rudolf Polzer <atfield-dt@durchnull.de> +o René Nussbaumer <public@killerfox.forkbomb.ch> Module contributors o dice.rb - David Dorward (Dorward) <david@david.us-lot.org> o lart.rb - Michael Brailsford <brailsmt@yahoo.com> o stats.rb - Michael Brailsford <brailsmt@yahoo.com> o ri.rb - Michael Brailsford <brailsmt@yahoo.com> +o bash/threat - Robin Kearney <robin@riviera.org.uk> "Testing" (having fun breaking rbot creatively) o Paul Duncan (pabs) <pabs@pablotron.org> @@ -1,3 +1,13 @@ +Thu Aug 11 00:04:31 BST 2005 Tom Gilbert <tom@linuxbrit.co.uk> + + * Patches from "Alexey I. Froloff" <raorn@altlinux.ru> + * Do not use "/home/#{Etc.getlogin}/" for default home directory, use + "#{Etc.getpwnam(Etc.getlogin).dir}/" instead. + * Do not try to load same plugin from different locations. Added ability + to disable system-wide plugins - create PLUGIN.rb.disabled in user's + plugins directory. + * For example, to disable freshmeat plugin installed in /usr/share/rbot/plugins/freshmeat.rb one can create empty file ~/.rbot/plugins/freshmeat.rb.disabled + Mon Aug 08 23:08:01 BST 2005 Tom Gilbert <tom@linuxbrit.co.uk> * new markov plugin for random inane chat @@ -1,3 +1,5 @@ +o if searchquote (or similar) has 3 results, roundrobin between them as +asked, don't respond a random one o freeze/thaw factoids (make them readonly) at higher auth o respond to insults o feed back errors from plugins (optional) diff --git a/data/rbot/plugins/bash.rb b/data/rbot/plugins/bash.rb new file mode 100644 index 00000000..6f954a16 --- /dev/null +++ b/data/rbot/plugins/bash.rb @@ -0,0 +1,56 @@ +# bash.org xml plugin for rbot +# by Robin Kearney (robin@riviera.org.uk) +# +# its a bit of a quick hack, but it works for us :) +# +require 'rexml/document' +require 'uri/common' + +class BashPlugin < Plugin + include REXML + def help(plugin, topic="") + "bash => print a random quote from bash.org, bash quote_id => print that quote id from bash.org, bash latest => print the latest quote from bash.org (currently broken, need to get josh@bash.org to fix the xml)" + end + def privmsg(m) + if m.params && m.params =~ /^([-\d]+)$/ + id = $1 + bash m, id + elsif(m.params == "latest") + bash m, id + else + bash m + end + end + + def bash(m, id=0) + + if(id != 0) + xml = @bot.httputil.get URI.parse("http://bash.org/xml/?" + id + "&num=1") + elsif(id == "latest") + xml = @bot.httputil.get URI.parse("http://bash.org/xml/?latest&num=1") + else + xml = @bot.httputil.get URI.parse("http://bash.org/xml/?random&num=1") + end + unless xml + m.reply "bash.org rss parse failed" + return + end + doc = Document.new xml + unless doc + m.reply "bash.org rss parse failed" + return + end + doc.elements.each("*/item") {|e| + if(id != 0) + reply = e.elements["title"].text.gsub(/QDB: /,"") + " " + e.elements["link"].text.gsub(/QDB: /,"") + "\n" + reply = reply + e.elements["description"].text.gsub(/\<br \/\>/, "\n") + else + reply = e.elements["title"].text.gsub(/QDB: /,"") + " " + e.elements["link"].text.gsub(/QDB: /,"") + "\n" + reply = reply + e.elements["description"].text.gsub(/\<br \/\>/, "\n") + end + m.reply reply + } + end +end +plugin = BashPlugin.new +plugin.register("bash") diff --git a/data/rbot/plugins/karma.rb b/data/rbot/plugins/karma.rb index 148427a5..824ffa95 100644 --- a/data/rbot/plugins/karma.rb +++ b/data/rbot/plugins/karma.rb @@ -52,7 +52,7 @@ class KarmaPlugin < Plugin def help(plugin, topic="") - "karma module: <thing>++/<thing>-- => increase/decrease karma for <thing>, karma for <thing>? => show karma for <thing>, karmastats => show stats. Karma is a community rating system - only in-channel messages can affect karma and you cannot adjust your own." + "karma module: Listens to everyone's chat. <thing>++/<thing>-- => increase/decrease karma for <thing>, karma for <thing>? => show karma for <thing>, karmastats => show stats. Karma is a community rating system - only in-channel messages can affect karma and you cannot adjust your own." end def listen(m) return unless m.kind_of?(PrivMessage) && m.public? diff --git a/data/rbot/plugins/lart.rb b/data/rbot/plugins/lart.rb index de767197..54c335af 100644 --- a/data/rbot/plugins/lart.rb +++ b/data/rbot/plugins/lart.rb @@ -78,7 +78,7 @@ class LartPlugin < Plugin #}}} #{{{ def help(plugin, topic="") - "Lart: The lart plugin allows you to punish/praise someone in the channel. You can also add new punishments and new praises as well as delete them. For the curious, LART is an acronym for Luser Attitude Readjustment Tool.\nUsage: punish/lart <nick> <reason> -- punishes <nick> for <reason>. The reason is optional.\n praise <nick> <reason> -- praises <nick> for <reason>. The reason is optional.\n mod[lart|punish|praise] [add|remove] -- Add or remove a lart or praise." + "Lart: The lart plugin allows you to punish/praise someone in the channel. You can also add new punishments and new praises as well as delete them. For the curious, LART is an acronym for Luser Attitude Readjustment Tool. Usage: punish/lart <nick> [<reason>] -- punishes <nick> for <reason>. praise <nick> [<reason>] -- praises <nick> for <reason>. [add|rm][lart|punish|praise] -- Add or remove a lart or praise." end #}}} # The following are command handlers {{{ diff --git a/data/rbot/plugins/threat.rb b/data/rbot/plugins/threat.rb new file mode 100644 index 00000000..ae709101 --- /dev/null +++ b/data/rbot/plugins/threat.rb @@ -0,0 +1,55 @@ +# Security threat level plugin for rbot +# by Robin Kearney (robin@riviera.org.uk) +# +# inspired by elliots fascination with the us +# threat level. +# +# again a dirty hack but it works, just... +# + +require 'uri/common' + +class ThreatPlugin < Plugin + + def help(plugin, topic="") + "threat => prints out the current threat level as reported by http://www.dhs.gov/" + end + + def privmsg(m) + color = "" + red = "\x0304" # severe + orange = "\x0307" # high + yellow = "\x0308" # elevated + blue = "\x0312" # guarded + green = "\x0303" # low + black = "\x0301" # default + + page = @bot.httputil.get URI.parse("http://www.dhs.gov/dhspublic/") + if page =~ / <img.*dhs\/images\/dhs-advisory-(.*).gif.*/ + state = $1 + end + case state + when "severe" + color = red + when "high" + color = orange + when "elevated" + color = yellow + when "guarded" + color = blue + when "low" + color = green + else + color = black + end + + m.reply color + "Today " + m.sourcenick + " the threat level is " + state.capitalize + + return + end + +end +plugin = ThreatPlugin.new +plugin.register("threat") + + |