summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/figlet.rb
blob: 598adfaffab91d10c609a96e026091f22a0ae14c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#DEFAULT_FONT="smslant"
DEFAULT_FONT="rectangles"
MAX_WIDTH=68

class FigletPlugin < Plugin
  def help(plugin, topic="")
    "figlet <message> => print using figlet"
  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.map "figlet *message"