repost/plugins/eval.rb

23 lines
659 B
Ruby
Raw Normal View History

include EventMachine::IRC::Commands
Client.register_trigger("PRIVMSG") { |msg|
if Config[:eval][:owners].include?(msg[:prefix]) then
message = msg[:params][1]
destination = msg[:params][0]
if message[0..5] == ":eval " then
code = message[6..-1]
begin
retval = proc {
eval(code)
}.call
Client.privmsg(destination, String.try_convert(retval.to_s))
rescue Exception => e
Client.privmsg(destination, e.inspect)
puts e.inspect
puts e.backtrace
end
end
end
}