summaryrefslogtreecommitdiff
path: root/rbot/plugins
diff options
context:
space:
mode:
authorTom Gilbert <tom@linuxbrit.co.uk>2005-07-16 01:18:13 +0000
committerTom Gilbert <tom@linuxbrit.co.uk>2005-07-16 01:18:13 +0000
commita08b4def5c276df964ae2a8d9c3f661593d757e6 (patch)
treecd563b11ab095bd364036d14bc28fb5fb4c065a8 /rbot/plugins
parent71e16adb8a62a78fc1e8cdcc6776b6cd84fbe758 (diff)
various fixes by me, plus most of Rene's patch (#1).
Diffstat (limited to 'rbot/plugins')
-rw-r--r--rbot/plugins/autorejoin.rb6
-rw-r--r--rbot/plugins/fortune.rb9
-rw-r--r--rbot/plugins/host.rb2
-rw-r--r--rbot/plugins/nslookup.rb2
-rw-r--r--rbot/plugins/quotes.rb4
-rw-r--r--rbot/plugins/spell.rb2
6 files changed, 16 insertions, 9 deletions
diff --git a/rbot/plugins/autorejoin.rb b/rbot/plugins/autorejoin.rb
index 03118f85..b5dd1ee1 100644
--- a/rbot/plugins/autorejoin.rb
+++ b/rbot/plugins/autorejoin.rb
@@ -4,8 +4,10 @@ class AutoRejoinPlugin < Plugin
end
def kick(m)
if m.address?
- @bot.join m.channel
- @bot.say m.channel, @bot.lang.get("insult") % m.sourcenick
+ @bot.timer.add_onceu(10, m) {|m|
+ @bot.join m.channel
+ @bot.say m.channel, @bot.lang.get("insult") % m.sourcenick
+ }
end
end
end
diff --git a/rbot/plugins/fortune.rb b/rbot/plugins/fortune.rb
index 2f76a318..fd90f69b 100644
--- a/rbot/plugins/fortune.rb
+++ b/rbot/plugins/fortune.rb
@@ -15,8 +15,13 @@ class FortunePlugin < Plugin
m.reply "incorrect usage: " + help(m.plugin)
return
end
- ret = Utils.safe_exec("/usr/games/fortune", "-n", "255", "-s", db)
- m.reply ret.split("\n").join(" ")
+ fortune = nil
+ ["/usr/games/fortune", "/usr/bin/fortune", "/usr/local/bin/fortune"].each {|f|
+ fortune = f if FileTest.executable? f
+ }
+ m.reply "fortune not found" unless fortune
+ ret = Utils.safe_exec(fortune, "-n", "255", "-s", db)
+ m.reply ret.gsub(/\t/, " ").split(/\n/).join(" ")
return
end
end
diff --git a/rbot/plugins/host.rb b/rbot/plugins/host.rb
index cb88eee7..ef8dc8bc 100644
--- a/rbot/plugins/host.rb
+++ b/rbot/plugins/host.rb
@@ -3,7 +3,7 @@ class HostPlugin < Plugin
"host <domain> => query nameserver about domain names and zones for <domain>"
end
def privmsg(m)
- unless(m.params =~ /^(\w|\.)+$/)
+ unless(m.params =~ /^(\w|-|\.)+$/)
m.reply "incorrect usage: " + help(m.plugin)
return
end
diff --git a/rbot/plugins/nslookup.rb b/rbot/plugins/nslookup.rb
index a68f0ee8..92da1ba7 100644
--- a/rbot/plugins/nslookup.rb
+++ b/rbot/plugins/nslookup.rb
@@ -38,7 +38,7 @@ class DnsPlugin < Plugin
rescue StandardError => err
m.reply "#{m.params}: not found"
end
- elsif(m.params =~ /^(\w|\.)+$/)
+ elsif(m.params =~ /^\S+$/)
begin
a = getaddresses(m.params)
m.reply m.params + ": " + a.join(", ")
diff --git a/rbot/plugins/quotes.rb b/rbot/plugins/quotes.rb
index 072e352a..0e46b495 100644
--- a/rbot/plugins/quotes.rb
+++ b/rbot/plugins/quotes.rb
@@ -64,7 +64,7 @@ class QuotePlugin < Plugin
return 0 unless(@lists.has_key?(channel))
return 0 unless(@lists[channel].length > 0)
if(regexp)
- matches = @lists[channel].compact.find_all {|a| a.quote =~ /#{regexp}/ }
+ matches = @lists[channel].compact.find_all {|a| a.quote =~ /#{regexp}/i }
else
matches = @lists[channel].compact
end
@@ -73,7 +73,7 @@ class QuotePlugin < Plugin
def searchquote(source, channel, regexp)
return nil unless(@lists.has_key?(channel))
return nil unless(@lists[channel].length > 0)
- matches = @lists[channel].compact.find_all {|a| a.quote =~ /#{regexp}/ }
+ matches = @lists[channel].compact.find_all {|a| a.quote =~ /#{regexp}/i }
if(matches.length > 0)
return matches[rand(matches.length)], @lists[channel].length - 1
else
diff --git a/rbot/plugins/spell.rb b/rbot/plugins/spell.rb
index eb80a48d..81ee1ac6 100644
--- a/rbot/plugins/spell.rb
+++ b/rbot/plugins/spell.rb
@@ -3,7 +3,7 @@ class SpellPlugin < Plugin
"spell <word> => check spelling of <word>, suggest alternatives"
end
def privmsg(m)
- unless(m.params && m.params =~ /^\w+$/)
+ unless(m.params && m.params =~ /^\S+$/)
m.reply "incorrect usage: " + help(m.plugin)
return
end