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