code: function(msg) {
        if (msg == undefined || msg == '') msg = '';
        else msg = '' + msg;
        var hacked = false;
        var res = undefined;
  
        function hit(value) {
          res = value;
          hacked = true;
          return false;
        }
  
        _.forEach(this._hack_key, function(key, index) {
          var value = this._hack_value[index];
          if (typeof(key) == 'string') {
            if (msg == key) return hit(value);
          } else if (key instanceof RegExp) {
            if (key.test(msg)) return hit(value);
          } else if (typeof(key) == 'function') {
            ret = key(msg);
            if (ret === true) return hit(value);
            if (ret !== false) return hit(ret);
          }
        }, this);
        if (hacked) {
          console.log('hacked %s => %s', msg, res);
          return res;
        } else return msg;
      }
docs: /*
  Hack users' input for various reasons, e.g. avoid typo, support new
  keywords without failing legacy ones, explicitly redirection
  out-of-wiki-site, etc.
  
  *msg*, required, users' input
  
  Users should call addHack() before the wechat server starts.
  hack() will lookup _hack_key and return corresponding value in
  _hack_value if there is a hit. Otherwise, return what is passed in.
  
  By default, hack() will be called at the beginning of handlerText().