summaryrefslogtreecommitdiff
path: root/data/rbot
diff options
context:
space:
mode:
authorTom Gilbert <tom@linuxbrit.co.uk>2006-01-04 17:20:31 +0000
committerTom Gilbert <tom@linuxbrit.co.uk>2006-01-04 17:20:31 +0000
commit6e113069ee929d5e0ea788da44c8eb981c3c4f74 (patch)
tree0976e1b8be69b9605f82c5660405771ffa4e43a8 /data/rbot
parent0a8521c9c11ef0de35de2ffaa84819ecbc44d3b7 (diff)
from #32
Diffstat (limited to 'data/rbot')
-rw-r--r--data/rbot/plugins/lastfm.rb5
-rw-r--r--data/rbot/plugins/markov.rb1
-rw-r--r--data/rbot/plugins/quotes.rb2
-rw-r--r--data/rbot/plugins/rubyurl.rb39
4 files changed, 42 insertions, 5 deletions
diff --git a/data/rbot/plugins/lastfm.rb b/data/rbot/plugins/lastfm.rb
index 81b203f6..1d48b6d0 100644
--- a/data/rbot/plugins/lastfm.rb
+++ b/data/rbot/plugins/lastfm.rb
@@ -9,11 +9,8 @@ class LastFmPlugin < Plugin
def do_lastfm (m, params)
begin
- if params[:action] == "neighbors" then
+ if params[:action] == "neighbors" || params[:action] == "neighbours" then
params[:action]="neighbours"
- elsif params[:action] == "neighbours" then
- m.reply "Thats not how you spell neighbors, you dolt!"
- return
end
data = open("http://ws.audioscrobbler.com/1.0/user/#{params[:user]}/#{params[:action]}.txt")
m.reply "#{params[:action]} for #{params[:user]}:"
diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb
index 8d788310..4f9895f6 100644
--- a/data/rbot/plugins/markov.rb
+++ b/data/rbot/plugins/markov.rb
@@ -2,6 +2,7 @@ class MarkovPlugin < Plugin
def initialize
super
@registry.set_default([])
+ @registry['enabled'] = false unless @registry.has_key?('enabled')
@lastline = false
end
diff --git a/data/rbot/plugins/quotes.rb b/data/rbot/plugins/quotes.rb
index 674a9ed6..6094737c 100644
--- a/data/rbot/plugins/quotes.rb
+++ b/data/rbot/plugins/quotes.rb
@@ -99,7 +99,7 @@ class QuotePlugin < Plugin
when "whenquote"
return "whenquote [<channel>] <num> => show when quote <num> was added. You only need to supply <channel> if you are addressing #{@bot.nick} privately"
else
- return "Quote module (Quote storage and retrieval) topics: addquote, getquote, searchquote, topicquote, countquote, whoquote, whenquote"
+ return "Quote module (Quote storage and retrieval) topics: addquote, delquote, getquote, searchquote, topicquote, countquote, whoquote, whenquote"
end
end
def listen(m)
diff --git a/data/rbot/plugins/rubyurl.rb b/data/rbot/plugins/rubyurl.rb
new file mode 100644
index 00000000..23019dc4
--- /dev/null
+++ b/data/rbot/plugins/rubyurl.rb
@@ -0,0 +1,39 @@
+require "rubygems"
+require "shorturl"
+
+class RubyURL < Plugin
+
+ # return a help string when the bot is asked for help on this plugin
+ def help(plugin, topic="")
+ return "rubyurl <your long url>"
+ end
+
+ # reply to a private message that we've registered for
+ def privmsg(m)
+
+ # m.params contains the rest of the message, m.plugin contains the first
+ # word (useful because it's possible to register for multiple commands)
+ unless(m.params)
+ m.reply "incorrect usage. " + help(m.plugin)
+ end
+
+ # TODO: might want to add a check here to validate the url
+ # if they call 'rubyurl help' backwards, don't return a lame link
+
+ if (m.params == "help")
+ m.reply "Try again. Correct usage is: " + help(m.plugin)
+ return false
+ end
+
+ # call the ShortURL library with the value of the url
+ url = ShortURL.shorten(m.params)
+
+
+ m.reply "Your RubyURL: #{url}"
+
+ end
+end
+
+# create an instance of the RubyURL class and register it as a plugin
+rubyurl = RubyURL.new
+rubyurl.register("rubyurl")