From 8db3c907730752ccc668c69080680d1b90140c10 Mon Sep 17 00:00:00 2001 From: Tom Gilbert Date: Wed, 10 Aug 2005 23:12:50 +0000 Subject: [PATCH] AUTHORS update. Added two plugins from Robin Kearney --- AUTHORS | 5 ++++ ChangeLog | 10 +++++++ TODO | 2 ++ data/rbot/plugins/bash.rb | 56 +++++++++++++++++++++++++++++++++++++ data/rbot/plugins/karma.rb | 2 +- data/rbot/plugins/lart.rb | 2 +- data/rbot/plugins/threat.rb | 55 ++++++++++++++++++++++++++++++++++++ 7 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 data/rbot/plugins/bash.rb create mode 100644 data/rbot/plugins/threat.rb diff --git a/AUTHORS b/AUTHORS index e045b6f8..0c01959d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3,12 +3,17 @@ o Tom Gilbert (giblet) Patch contributors o Peter Suschlik (pesu) +o Alexey I. Froloff +o Ari Pollak +o Rudolf Polzer +o René Nussbaumer Module contributors o dice.rb - David Dorward (Dorward) o lart.rb - Michael Brailsford o stats.rb - Michael Brailsford o ri.rb - Michael Brailsford +o bash/threat - Robin Kearney "Testing" (having fun breaking rbot creatively) o Paul Duncan (pabs) diff --git a/ChangeLog b/ChangeLog index 8cfa72b8..9be8c62c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Thu Aug 11 00:04:31 BST 2005 Tom Gilbert + + * Patches from "Alexey I. Froloff" + * 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 * new markov plugin for random inane chat diff --git a/TODO b/TODO index ff120780..4172eea6 100644 --- a/TODO +++ b/TODO @@ -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(/\
/, "\n") + else + reply = e.elements["title"].text.gsub(/QDB: /,"") + " " + e.elements["link"].text.gsub(/QDB: /,"") + "\n" + reply = reply + e.elements["description"].text.gsub(/\
/, "\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: ++/-- => increase/decrease karma for , karma for ? => show karma for , 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. ++/-- => increase/decrease karma for , karma for ? => show karma for , 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 -- punishes for . The reason is optional.\n praise -- praises for . 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 [] -- punishes for . praise [] -- praises for . [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 =~ /