Giter Club home page Giter Club logo

weixin-robot's Issues

谁建个群交流啊

因为刚接触,所以很多东西不懂。
希望有哪个大大建个Q群大家交流交流,如果没有的话。我这边有个空的群。
3616268 欢迎大家。

微信多次发送消息

如果消息设置不做回复(info.ended = true),微信服务器则会发送同样的消息3次。我如何避免让微信服务器重发消息?

求问一下webot中关于yaml的问题

@ktmud ,你好,我最近尝试了下你的weixin-robot和webot-douban-event,感觉非常爽,现在遇到一个问题请教一下:

在webot-douban-event中,rules/dialogs下边有很多的.yaml文件,我直接把文件夹复制过来了,然后尝试了一下,出现下边这种问题:

webot:robot:log define route: [jielong] +0ms
webot:robot:log require dialog file: /home/ymcdull/node_funny/webot-example/rules/dialogs/basic.yaml +3ms

/......./webot-example/rules/dialogs/basic.yaml:1
require, module, __filename, __dirname) { /^(都?有(哪些|什么)(好玩的)?)?活动[??!!]_$/:
^
SyntaxError: Unexpected token :
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module.load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /home/ymcdull/node_funny/webot-example/node_modules/weixin-robot/node_modules/webot/lib/webot.js:216:11
at Array.forEach (native)
at Webot.dialog (/home/ymcdull/node_funny/webot-example/node_modules/weixin-robot/node_modules/webot/lib/webot.js:212:8)
at module.exports (/home/ymcdull/node_funny/webot-example/rules/dialogs/index.js:3:7)
npm ERR! weird error 8
npm ERR! not ok code 0
make: *
* [start] 错误 1

貌似是.yaml中的问题,如果我在正则匹配或者字符串前后加上引号,这个错误就没有了,请教一下这是什么原因?有没有什么方法可以不用把所有的匹配都加上引号来排除这个问题?多谢

无法使用其他路径

由于wechat包本身有带一些接口,我本来希望通过express做一个和微信对接以及一个微信代理接口。但是所有页面都是显示invalid signature。大致代码如下

app = express();
//All Requests return "invalid signature"
app.get('/media/', routes.media);
wechat.watch(app, { token: data.token, path: '/' });
wechat.set('welcome', {
  pattern: function(info) {
    return info.is('event') && info.param.event == 'subscribe';
  },
  handler: data.welcome
});

无法通过接入

你好,我在服务器上安装调试您的程序,然后准备接入微信公众平台,我修改了监听地址和token,但管网说无法响应,服务器上的webot调试成功,求解,谢谢。

语音识别接口还是有bug

webot.set('voice', {
        pattern: function(info) {
            return info.is('voice');
        },
        handler: function(info) {
            console.log(info.text);
            console.log(info.param.recognition);
            if (info.text) {
                return info.text;
            };
        }
    });

我的代码如上,发送语音消息之后,info.text,info.param.recognition均是空字符串

经常会出现204请求

部署上微信号之后,有的时候是好的,能正常回复信息。
有的时候是204请求,无法接受到发送内容,不能正常回复信息。
请问有没有人知道这是怎么回事?

handler里使用异步事件

是否能在handler里面使用异步事件, 异步事件里面需要调动handler callback里面的info. 不知道应该如何实现

    function generate_req(one_row) { //factory函数

      return function(info) {

          urllib.request(one_row.content, { data: info.param }, function (err, data) {
              if (err) {
                  console.log('callback error. ' + err.toString());
              }

              data = data.toString();
              try {
                  data = JSON.parse(data);
              } catch(e) {
                  console.log('callback JSON parse error. ' + e.toString());
              }

              //return data to function(info) here
              return data;

          });

      };

    }

noReply = true无效

目前我的第一条rule是基于用户是否启动会话从而判断是否由weixin-robot来回复,否的话,noReply = true。但是不知为何,程序总是会跳到下一条rule,而且这是info为空,导致程序崩溃。大致代码如下

    wechat.set('SUPPORT', {
      pattern: function(info) {
        return info.session.chatUsers.indexOf(info.uid) !== -1;
      },
      handler: function(info) {
        if( info.is('event') ) {
          info.reply = 'Doing Stuff...';
        } else {
          eventEmitter.emit('userMessage', info.uid, info.text);
          info.noReply = true; //这里就不应该继续跳下去
        }
      }
    });
    wechat.set('SERVICE_DELIVERY', {
      pattern: function(info) {
        return info.param.eventKey.toLowerCase() === 'service_delivery'; //这里崩溃了
      },
      handler: 'some reply'
    });

location的用法

请问example中的location是怎么使用了? 我在客户端发送什么能返回给我location

链接菜单没有跳转

我使用包含的wechat包创建了带有链接的菜单。但是点击的时候没有跳转。查询菜单的时候看起来是对的。Log告诉我请求返回到了我的服务器这里由wechat包处理,因为没有匹配的rule,最后匹配失败。

代码生成的菜单大致是这样的

{ button: 
   [ { name: 'StuffParent', sub_button: 
     [ { key: 'FARM_LIST', type: 'click', name: 'StuffStuff' },
       { key: 'RESELLER_LIST', type: 'click', name: 'Stuff1' },
       { url: '"http://example.com"', type: 'view', name: 'Stuff2' },
       { key: 'EVENT_LIST', type: 'click', name: 'Stuff3' } ] } ] }

附加微信调试工具出的菜单截图

screen shot 2014-01-02 at 21 36 21

Doc里面似乎有个小错误

关于Info对象:

ToUserName      开发者微信号                   info.uid
FromUserName    发送方帐号(一个OpenID)        info.sp                     sp means "service provider"

是不是反了?

ps 感谢,正在整合weixin-robot到我们的项目中。

新更新的example测试无法通过

看见@ktmud在一个小时前更新了实例,估计现在还在弄,我测试了下,无法跑起来哦。在app.js里使用了webot.watch来监听消息请求,之前是webot.monitor(app, 'your1weixin2token');我测试的时候,显示no method of "watch".

不维护更新了?

这个项目其实挺好的,不过微信公布的接口有更新,作者不同步更新了吗?比如微信支持回复音乐和视频之类~
还想问一个小问题:
文档中的:
4. set DEBUG=weixin.* (设置环境变量方可查看调试信息)
我在shell里做了,不起作用?请问是什么原因?我google这个debug模块的使用也找不到相关的使用介绍...

自我介绍的的问题

rules.js中的这段代码

  webot.set({
    name: 'your_name',
    description: '自我介绍下吧, 发送: I am [enter_your_name]',
    pattern: /^(?:my name is|i am|我(?:的名字)?(?:是|叫)?)\s*(.*)$/i,
    // handler: function(info, action){
    //   return '您好,' + info.query[1]
    // }

    //或者更简单一点
    handler: '您好,{1}'
  });

我在dialog.yaml中定义了"我爱你“的自动回复截断无效
IMG_0872

去 underscore ,去 wind.js

wind.js 写出来的代码难以调试,而且有潜在的性能问题。不了解这套机制的人维护起来也比较困难

underscore 是浏览器端产物,服务器端大部分时候不需要用到

各种 type 判断可以使用原生代码,extend defaults 等 utils 方法可以自己 include

模版工具可以用 lodash-template 代替

cc @atian25

取消对 js-yaml 的依赖

既然载入一个 yaml 模块只是 require('a.yaml') 那样简单,
就可以把是否使用 yaml 的决定权交还给用户。

联动问题

请问如何实现example里的waits到routes的联动?

比如说 在 routes中 输入 ‘搜索500’ 联动到 waites中询问 ‘您是要搜索伍佰吗?’ 得到确定回复后 联动到routes中执行搜索。

特殊消息的shorthand api

使支持:

webot.image(function() {
   // ...
}).location(function() {
   // ...
}).event(function() {
   // ...
});

多层回复

现在我的菜单需要输出一些内容,然后依照用户的输入来判断回复。之前在使用wechat包的时候,直接测试

List.add('stuff', [
  ['回复{a}', '成功回复a']
  ['回复{b}', '成功回复b']
]);
var eventResponse = function (info, req, res, next) {
    res.wait('stuff');
};
var wechatObj = wechat(mytoken, wechat.event(eventResponse).text(textResponse));

然后挂一个List在eventResponse里面执行。现在如果得到同样的结果呢?我只能通过webot.set调回一个str或者obj或者arr。如何在webot.set里面回复另外一个webot.set?

建议把node-expat换为纯JS的实现,如node-xml

很多虚拟主机如nae, cloudfoundry都是不支持c++的类库的.
建议换为pure javascript的类库.

PS1: 本想写个类库的, 却发现仁兄把我想写的都写了....

PS2: 正在看waitor那块,因为想做的东西是有流程的,而不仅仅是一两个来回的问答

繁体支持

提供办法将繁体转换成简体消息。可以先用 iconv 搞搞,然后再试一下 opencc 。

webot 使用问题

运行您的example,修改了端口号和WX_TOKEN。部署到服务器上微信能成功调用。
我在本地做测试时候遇到了如下的问题。请问这个应该怎么解决 ?

nasaAir:bin nasa$ webot -t mytest
the text: hi

events.js:71
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: connect ECONNREFUSED
    at errnoException (net.js:769:11)
    at Object.afterConnect [as oncomplete] (net.js:760:19)
nasaAir:bin nasa$ 

其他文件干嘛用的?

已经成功在本地与appfog上配置,并且微信可以使用。
不过只用到了examples文件夹内的app.js rules.js support.js
外面的一些文件,比如index.js引用的lib文件夹下是用来干嘛的?
能举例说明下其他文件干嘛用的吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.