2014-03-09 09:55:01 +00:00
|
|
|
include EventMachine::IRC::Commands
|
|
|
|
|
|
|
|
Client.register_trigger("PRIVMSG") { |msg|
|
2014-03-25 06:24:54 +00:00
|
|
|
message = msg[:params][1]
|
|
|
|
destination = msg[:params][0]
|
|
|
|
|
2014-03-25 06:30:51 +00:00
|
|
|
if message[0..5] == ":eval " then
|
|
|
|
if Config[:eval][:owners].include?(msg[:prefix]) then
|
2014-03-25 06:08:58 +00:00
|
|
|
code = message[6..-1]
|
|
|
|
begin
|
|
|
|
retval = proc {
|
|
|
|
eval(code)
|
|
|
|
}.call
|
2014-03-09 09:55:01 +00:00
|
|
|
|
2014-03-25 06:08:58 +00:00
|
|
|
Client.privmsg(destination, String.try_convert(retval.to_s))
|
|
|
|
rescue Exception => e
|
|
|
|
Client.privmsg(destination, e.inspect)
|
|
|
|
puts e.inspect
|
|
|
|
puts e.backtrace
|
|
|
|
end
|
2014-03-25 06:30:51 +00:00
|
|
|
else
|
|
|
|
Client.privmsg(destination, Config[:eval][:denied])
|
2014-03-09 09:55:01 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|