Re-do the eval plugin - permit only bot owners.

master
Robert Gerus 2014-03-25 07:08:58 +01:00
parent 04de76cc0c
commit 14b64e632d
1 changed files with 15 additions and 15 deletions

View File

@ -1,15 +1,14 @@
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
prog = message[6..-1]
puts "will try to eval: #{prog}"
code = message[6..-1]
begin
retval = proc {
$SAFE = 4
eval(prog)
eval(code)
}.call
Client.privmsg(destination, String.try_convert(retval.to_s))
@ -19,4 +18,5 @@ Client.register_trigger("PRIVMSG") { |msg|
puts e.backtrace
end
end
end
}