var format = require("util").format;

var TennuEval = {
    requires: ["admin"],
    init: function(client, imports) {

        function handleEval(IRCMessage) {
            return imports.admin.isAdmin(IRCMessage.hostmask)
            .then(function (result) {
                if(!result){
                    adminFail(IRCMessage.nickname, IRCMessage.hostmask.hostname);
                }
                if(IRCMessage.message.search(/^\>\>/) > -1){
                    return ("<<"+eval(IRCMessage.message.substr(2))).split('\n');   
                }
            })
        };

        function adminFail(nickname, hostname) {
            return {
                intent: 'notice',
                query: true,
                message: ['Restricted access.', format('Logged: %s@%s.', nickname, hostname)]
            };
        }

        return {
            handlers: {
                "privmsg": handleEval,
            }
        };
    }
};

module.exports = TennuEval;
@@ -151,24 +151,125 @@
 CMessage) %7B%0A
+%0A            if (IRCMessage.message.search(/%5E%5C%3E%5C%3E/) === -1) %7B%0A                return;%0A            %7D%0A%0A
             
@@ -330,16 +330,20 @@
         
+    
 .then(fu
@@ -348,17 +348,16 @@
 function
- 
 (result)
@@ -375,18 +375,23 @@
         
+  
+  
 if
+ 
 (!result
@@ -391,16 +391,17 @@
 !result)
+ 
 %7B%0A      
@@ -414,16 +414,27 @@
         
+  
+  return 
 adminFai
@@ -506,71 +506,14 @@
     
- %7D%0A
      
-           if(IRCMessage.message.search(/%5E%5C%3E%5C%3E/) %3E -1)%7B
+%7D
 %0A   
@@ -545,9 +545,11 @@
 %22%3C%3C%22
-+
+ + 
 eval
@@ -596,30 +596,13 @@
 n');
+%0A 
    
-%0A                %7D%0A
     

Check for eval match and exit right away. Fix not returning error messages.