diff options
author | Tom Gilbert <tom@linuxbrit.co.uk> | 2004-10-09 01:51:05 +0000 |
---|---|---|
committer | Tom Gilbert <tom@linuxbrit.co.uk> | 2004-10-09 01:51:05 +0000 |
commit | 0f3e302547363ea237454dda891ddb5de1be4476 (patch) | |
tree | ec45be24a669ee28b5e2da4ff65e39265a418e0b /rbot/plugins/fortune.rb |
initial import of rbot
Diffstat (limited to 'rbot/plugins/fortune.rb')
-rw-r--r-- | rbot/plugins/fortune.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/rbot/plugins/fortune.rb b/rbot/plugins/fortune.rb new file mode 100644 index 00000000..2f76a318 --- /dev/null +++ b/rbot/plugins/fortune.rb @@ -0,0 +1,24 @@ +class FortunePlugin < Plugin + def help(plugin, topic="") + "fortune [<module>] => get a (short) fortune, optionally specifying fortune db" + end + def privmsg(m) + case m.params + when (/\B-/) + m.reply "incorrect usage: " + help(m.plugin) + return + when (/^([\w-]+)$/) + db = $1 + when nil + db = "fortunes" + else + 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(" ") + return + end +end +plugin = FortunePlugin.new +plugin.register("fortune") |