X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fscript.rb;h=c994d4da91c95a0a663d72473b1ac896b4d921a5;hb=bf2a5a05b86773da8351ae01d94b0fecd5c4519a;hp=38bb3134828002cf0e356f9532e70e7f734f1e35;hpb=ac39a3b330cbf7c4b65ba907783364b63fb109b3;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/script.rb b/data/rbot/plugins/script.rb index 38bb3134..c994d4da 100644 --- a/data/rbot/plugins/script.rb +++ b/data/rbot/plugins/script.rb @@ -21,6 +21,7 @@ class ScriptPlugin < Plugin super if @registry.has_key?(:commands) @commands = @registry[:commands] + raise unless @commands else @commands = Hash.new end @@ -69,29 +70,31 @@ class ScriptPlugin < Plugin def handle_eval( m, params ) code = params[:code].to_s.dup.untaint - Thread.start { - # TODO allow different safe levels for different botusers - begin - eval( code ) - rescue Exception => e - m.reply( "Script '#{name}' crapped out :(" ) - m.reply( e.inspect ) - end - } + Thread.start { + # TODO allow different safe levels for different botusers + begin + eval( code ) + rescue Exception => e + m.reply( "Script '#{name}' crapped out :(" ) + m.reply( e.inspect ) + end + } + m.replied = true end def handle_echo( m, params ) code = params[:code].to_s.dup.untaint - Thread.start { - # TODO allow different safe levels for different botusers - begin - m.reply eval( code ).to_s - rescue Exception => e - m.reply( "Script '#{name}' crapped out :(" ) - m.reply( e.inspect ) - end - } + Thread.start { + # TODO allow different safe levels for different botusers + begin + m.reply eval( code ).to_s + rescue Exception => e + m.reply( "Script '#{name}' crapped out :(" ) + m.reply( e.inspect ) + end + } + m.replied = true end @@ -110,7 +113,7 @@ class ScriptPlugin < Plugin command = Command.new( code, nick, created, channel ) @commands[name] = command - m.reply( "done" ) + m.okay end @@ -126,7 +129,7 @@ class ScriptPlugin < Plugin end @commands.delete( name ) - m.reply( "done" ) + m.okay end