All pastes #95743 Raw Edit

Untitled

public text v1 · immutable
#95743 ·published 2006-07-22 08:18 UTC
rendered paste body
code:

class EvalPlugin < Plugin
  def help(plugin, topic="")
    "rot13 <string> => encode <string> to rot13 or back"
  end
  def eval(m, params)
    debug "eval params " << params.inspect
    toeval = params[:phrase].join
    debug "eval toeval " << toeval.inspect
    result = eval(toeval)
    debug "eval result " << result.inspect
    m.reply p(result)
  end
end
plugin = EvalPlugin.new
plugin.map 'eval *phrase'

i type: ~ eval 3

debug output:
D: [2006/07/22 10:18:25] RECV: ":giorgian!n=user@host116-102.pool8711.interbusiness.it PRIVMSG #mychannel :~ eval 3"
D: [2006/07/22 10:18:25] checking auth for eval
D: [2006/07/22 10:18:25] template match found and auth'd: "eval" {:phrase=>["3"]}
D: [2006/07/22 10:18:25] eval params {:phrase=>["3"]}
D: [2006/07/22 10:18:25] eval toeval "3"
E: [2006/07/22 10:18:25] plugin eval|echo privmsg() failed: ArgumentError: wrong number of arguments (1 for 2)
E: [2006/07/22 10:18:25] (eval):9:in `eval'
E: [2006/07/22 10:18:25] (eval):9:in `eval'
E: [2006/07/22 10:18:25] /usr/local/lib/site_ruby/1.8/rbot/messagemapper.rb:132:in `handle'
E: [2006/07/22 10:18:25] /usr/local/lib/site_ruby/1.8/rbot/messagemapper.rb:118:in `handle'
E: [2006/07/22 10:18:25] /usr/local/lib/site_ruby/1.8/rbot/plugins.rb:119:in `privmsg'
E: [2006/07/22 10:18:25] /usr/local/lib/site_ruby/1.8/rbot/plugins.rb:300:in `privmsg'
E: [2006/07/22 10:18:25] /usr/local/lib/site_ruby/1.8/rbot/ircbot.rb:1015:in `delegate_privmsg'
E: [2006/07/22 10:18:25] /usr/local/lib/site_ruby/1.8/rbot/ircbot.rb:1014:in `delegate_privmsg'
E: [2006/07/22 10:18:25] /usr/local/lib/site_ruby/1.8/rbot/ircbot.rb:833:in `onprivmsg'
E: [2006/07/22 10:18:25] /usr/local/lib/site_ruby/1.8/rbot/ircbot.rb:255:in `initialize'
E: [2006/07/22 10:18:25] /usr/local/lib/site_ruby/1.8/rbot/rfc2812.rb:1103:in `handle'
E: [2006/07/22 10:18:25] /usr/local/lib/site_ruby/1.8/rbot/rfc2812.rb:1043:in `process'
E: [2006/07/22 10:18:25] /usr/local/lib/site_ruby/1.8/rbot/ircbot.rb:446:in `mainloop'
E: [2006/07/22 10:18:25] /usr/local/bin/rbot:93