Comments (4)
你接受点击事件的rule怎么写的?
On Jan 2, 2014 9:42 PM, "Angela" [email protected] wrote:
我使用包含的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' } ] } ] }附加微信调试工具出的菜单截图
[image: screen shot 2014-01-02 at 21 36 21]https://f.cloud.github.com/assets/2039144/1832418/b22b0368-73b3-11e3-8b1c-5dfaf95af34b.png
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/71
.
from weixin-robot.
点击事件的rule都没有match上啊,一般都是用对象里面有pattern,handler,然后有时候有replies。
from weixin-robot.
你 match 点击事件的 rule 的 pattern 怎么写的?
得像这样新加一个匹配 event 类消息的 rule ,把 info 重写成文本类消息:
webot.set('click-menu', {
pattern: function(info) {
return info.is('event') && info.param.event.toLowerCase() == 'click';
},
handler: function(info) {
info.type = 'text';
info.text = info.param.eventKey;
},
});
然后就会继续按正常文本消息的逻辑来匹配 rule 了。注意这段代码必须在所有文本rule定义之前。
from weixin-robot.
cool,原来可以重写。
from weixin-robot.
Related Issues (20)
- Doc里面似乎有个小错误 HOT 2
- handler里使用异步事件 HOT 1
- 请问新出的语音辨识接口加上了吗? HOT 5
- 语音识别接口还是有bug HOT 5
- 经常会出现204请求 HOT 1
- 微信多次发送消息 HOT 4
- 能否拿到发信的人的ip地址? HOT 3
- 机器人自动回复时, 回复内容可以在别的回调函数里面吗(wechat单独使用,指定res.reply是可以的) HOT 4
- 在handler中return图文信息的时候url无法带入多个参数 HOT 2
- 微博也做了类似的post推送机制,能否兼容一下? HOT 3
- 该公众号暂时无法提供服务,请稍后再试 HOT 4
- 请教下 如何把yaml修改为json么? HOT 2
- 有计划支持安全模式么? HOT 4
- 代码全是express3.x的,有没有express4.x以上版本? HOT 1
- 多客服系统没有接入么? HOT 5
- 配置正常,但是没有自动回复 HOT 1
- 为什么老会显示don't konw what you are saying HOT 2
- 规则库
- 国务院与该项目的合作
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from weixin-robot.