node-webot / weixin-robot

微信公共帐号自动回复机器人 A Node.js robot for wechat.
1.76k stars 555 forks source link

机器人自动回复时, 回复内容可以在别的回调函数里面吗(wechat单独使用,指定res.reply是可以的) #76

Closed zhaoyou closed 10 years ago

ktmud commented 10 years ago

什么意思?你期望的代码是什么?

zhaoyou commented 10 years ago

@ktmud 我想在回调函数(调用第三方服务)里面回复内容。

ktmud commented 10 years ago

@zhaoyou handler 天然可以写成异步的形式啊,你只需调用第三方服务,把结果用callback传过去就好了

https://github.com/node-webot/webot-example/blob/25a542fbd8fb44e624419de04206725522278348/rules/index.js#L243-L257

也许是文档说得不够清楚,我改一下

zhaoyou commented 10 years ago

@ktmud Thanks. 我太懒了,没有看源码。