Danger, danger, high voltage, it can explode.
This commit is contained in:
parent
73f345eefc
commit
99023f5388
1 changed files with 22 additions and 0 deletions
22
plugins/eval.rb
Normal file
22
plugins/eval.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
include EventMachine::IRC::Commands
|
||||
|
||||
Client.register_trigger("PRIVMSG") { |msg|
|
||||
message = msg[:params][1]
|
||||
destination = msg[:params][0]
|
||||
if message[0..5] == ":eval " then
|
||||
prog = message[6..-1]
|
||||
puts "will try to eval: #{prog}"
|
||||
begin
|
||||
retval = proc {
|
||||
$SAFE = 4
|
||||
eval(prog)
|
||||
}.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
|
||||
}
|
Loading…
Reference in a new issue