summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/figlet.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-14 22:00:08 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-02-14 22:00:08 +0000
commitd29df50ddaf32536b105decefb135a0b86ee937f (patch)
treeeaf5505ba5a8b569aefdb157eff80cf902fe444d /data/rbot/plugins/figlet.rb
parentad78fb47422664c9ce24a3b62194e42974274af7 (diff)
Modernize/optimize/cleanup a bunch of plugins
Remove some unnecessary plugin.register() calls, replace other by plugin.map() calls. Also use e.g. Array#pick_one instead of ar[rand(ar.length)]
Diffstat (limited to 'data/rbot/plugins/figlet.rb')
-rw-r--r--data/rbot/plugins/figlet.rb26
1 files changed, 12 insertions, 14 deletions
diff --git a/data/rbot/plugins/figlet.rb b/data/rbot/plugins/figlet.rb
index f82288eb..598adfaf 100644
--- a/data/rbot/plugins/figlet.rb
+++ b/data/rbot/plugins/figlet.rb
@@ -4,21 +4,19 @@ MAX_WIDTH=68
class FigletPlugin < Plugin
def help(plugin, topic="")
- "figlet [<message>] => print using figlet"
+ "figlet <message> => print using figlet"
end
- def privmsg(m)
- case m.params
- when nil
- m.reply "incorrect usage: " + help(m.plugin)
- return
- when (/^-/)
- m.reply "incorrect usage: " + help(m.plugin)
- return
- else
- m.reply Utils.safe_exec("/usr/bin/figlet", "-k", "-w", "#{MAX_WIDTH}", "-f", DEFAULT_FONT, m.params)
- return
- end
+
+ def figlet(m, params)
+ message = params[:message].to_s
+ if message =~ /^-/
+ m.reply "the message can't start with a - sign"
+ return
+ end
+ m.reply Utils.safe_exec("/usr/bin/figlet", "-k", "-w", "#{MAX_WIDTH}", "-f", DEFAULT_FONT, message)
+ return
end
end
+
plugin = FigletPlugin.new
-plugin.register("figlet")
+plugin.map "figlet *message"