X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fscript.rb;h=2d730fe92c426cb8cd012a3d03ae0db9d0ba35e5;hb=0ed9bf788d778eba03d65ad19cea6c0a5c432870;hp=83a1c9144f3efa1cfddb0ad0b6ebed8af1126fb6;hpb=3d901ac98e5bf4c4c8e1a605208fabc4ba71a73e;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/script.rb b/data/rbot/plugins/script.rb index 83a1c914..2d730fe9 100644 --- a/data/rbot/plugins/script.rb +++ b/data/rbot/plugins/script.rb @@ -41,6 +41,12 @@ class ScriptPlugin < Plugin end end + def report_error(m, name, e) + # ed = e.backtrace.unshift(e.inspect).join(' ') + ed = e.inspect + m.reply( "Script '#{name}' crapped out :( #{ed}" ) + end + def listen( m ) name = m.message.split.first @@ -60,10 +66,10 @@ class ScriptPlugin < Plugin begin eval( code ) rescue Exception => e - m.reply( "Script '#{name}' crapped out :(" ) - m.reply( e.inspect ) + report_error(m, name, e) end } + m.replied = true end end @@ -75,8 +81,7 @@ class ScriptPlugin < Plugin begin eval( code ) rescue Exception => e - m.reply( "Script '#{name}' crapped out :(" ) - m.reply( e.inspect ) + report_error(m, code, e) end } m.replied = true @@ -90,8 +95,7 @@ class ScriptPlugin < Plugin begin m.reply eval( code ).to_s rescue Exception => e - m.reply( "Script '#{name}' crapped out :(" ) - m.reply( e.inspect ) + report_error(m, code, e) end } m.replied = true @@ -113,7 +117,7 @@ class ScriptPlugin < Plugin command = Command.new( code, nick, created, channel ) @commands[name] = command - m.reply( "done" ) + m.okay end @@ -129,7 +133,7 @@ class ScriptPlugin < Plugin end @commands.delete( name ) - m.reply( "done" ) + m.okay end