File tree Expand file tree Collapse file tree 21 files changed +493
-26
lines changed
Expand file tree Collapse file tree 21 files changed +493
-26
lines changed Original file line number Diff line number Diff line change 22WeRoBot
33====================================
44
5- .. image :: https://api.travis-ci.org/whtsky/WeRoBot.png?branch=master
5+ .. image :: https://api.travis-ci.org/whtsky/WeRoBot.png?branch=develop
66 :target: http://travis-ci.org/whtsky/WeRoBot
7- .. image :: https://coveralls.io/repos/whtsky/WeRoBot/badge.png?branch=master
7+ .. image :: https://coveralls.io/repos/whtsky/WeRoBot/badge.png?branch=develop
88 :target: https://coveralls.io/r/whtsky/WeRoBot
9- .. image :: https://pypip.in/v/WeRoBot/badge.png
10- :target: https://crate.io/packages/WeRoBot/
11- .. image :: https://pypip.in/d/WeRoBot/badge.png
12- :target: https://crate.io/packages/WeRoBot/
9+ .. image :: https://scrutinizer-ci.com/g/whtsky/WeRoBot/badges/quality-score.png?b=develop
10+ :target: https://scrutinizer-ci.com/g/whtsky/WeRoBot/?branch=develop
11+
1312
1413WeRoBot 是一个微信机器人框架,采用MIT协议发布。
1514
Original file line number Diff line number Diff line change 11< h3 > 关于</ h3 >
22WeRoBot 是一个高中生利用闲暇时间写成的微信公共平台开发框架。如果你喜欢 WeRoBot ,请考虑捐助:
33< ul >
4- < li > < a href ="http://me.alipay.com/whtsky "> 支付宝</ a > </ li >
54 < li > < a href ="https://www.gittip.com/whtsky/ "> GitTip</ a > </ li >
65</ ul >
76
Original file line number Diff line number Diff line change 11Changelog
22=============
33
4+ Version 0.6.0
5+ ----------------
6+
7+ + Add ``@werobot.filter ``
8+ + Add :class: `werobot.session.saekvstorage `
9+ + Add support for Weixin Pay ( :class: `werobot.pay.WeixinPayClient ` )
10+ + Add ``werobot.reply.TransferCustomerServiceReply ``
11+ + Fix FileStorage's bug
12+
413Version 0.5.3
514----------------
615
Original file line number Diff line number Diff line change @@ -87,3 +87,5 @@ server 支持以下几种:
8787-----------------
8888
8989参考: `示例仓库 <https://github.com/whtsky/WeRoBot-SAE-demo >`_
90+
91+ 如果你需要使用 Session ,最好使用 :class: `werobot.session.saekvstorage ` 。
Original file line number Diff line number Diff line change @@ -96,8 +96,8 @@ robot.unknown 未知类型
9696
9797.. note :: 通过 ``robot.handler`` 添加的 handler 将收到所有信息;只有在其他 handler 没有给出返回值的情况下, 通过 ``robot.handler`` 添加的 handler 才会被调用。
9898
99- robot.key_click 修饰符
100- -------------------------
99+ robot.key_click —— 回应自定义菜单
100+ ---------------------------------
101101
102102``@robot.key_click `` 是对 ``@robot.click `` 修饰符的改进。
103103
@@ -114,3 +114,44 @@ robot.key_click 修饰符
114114 if message.key == "abort":
115115 return "I'm a robot"
116116两者是等价的。
117+
118+ robot.filter —— 回应有指定文本的消息
119+ -------------------------------------
120+
121+ ``@robot.filter `` 是对 ``@robot.text `` 修饰符的改进。
122+
123+ 现在你可以写这样的代码 ::
124+
125+ @robot.filter("a")
126+ def a():
127+ return "正文为 a "
128+
129+ import re
130+
131+
132+ @robot.filter(re.compile(".*?bb.*?"))
133+ def b():
134+ return "正文中含有 b "
135+
136+ @robot.filter(re.compile(".*?c.*?"), "d")
137+ def c():
138+ return "正文中含有 c 或正文为 d"
139+
140+ 这段代码等价于 ::
141+
142+ @robot.text
143+ def a(message):
144+ if message.content == "a":
145+ return "正文为 a "
146+ import re
147+
148+
149+ @robot.text
150+ def b():
151+ if re.compile(".*?bb.*?").match(message.content):
152+ return "正文中含有 b "
153+
154+ @robot.text
155+ def c():
156+ if re.compile(".*?c.*?").match(message.content) or message.content == "d":
157+ return "正文中含有 c 或正文为 d"
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ WeRoBot 是一个微信机器人框架,采用 MIT 协议发布。
1515 replies
1616 session
1717 client
18+ pay
1819 deploy
1920 utils
2021 changelog
Original file line number Diff line number Diff line change 1+ ``WeRoBot.pay.WeixinPayClient `` —— 微信支付 API 操作类
2+ =================================
3+
4+ .. module :: werobot.pay
5+
6+ .. autoclass :: WeixinPayClient
7+ :members:
Original file line number Diff line number Diff line change 11回复
22==============
33
4- 目前WeRoBot共有三种Reply : `TextReply ` , `ArticlesReply ` 和 `MusicReply ` 。他们都继承自 `WeChatReply ` 。
4+ 目前WeRoBot共有四种Reply : `TextReply ` , `ArticlesReply ` , `MusicReply ` 和 ` TransferCustomerServiceReply ` 。他们都继承自 `WeChatReply ` 。
55
66TextReply
77-----------
@@ -62,7 +62,7 @@ url 点击图片后跳转链接
6262 reply = ArticlesReply(message=message)
6363 article = Article(
6464 title="WeRoBot",
65- desription ="WeRoBot是一个微信机器人框架",
65+ description ="WeRoBot是一个微信机器人框架",
6666 img="https://github.com/apple-touch-icon-144.png",
6767 url="https://github.com/whtsky/WeRoBot"
6868 )
@@ -142,4 +142,9 @@ flag 如果是True, WeRoBot会对这条消息进行星标。你
142142 robot.run()
143143
144144
145- .. [3 ] 如果你省略了高质量音乐链接的地址, WeRoBot 会自动将音乐链接的地址用于高质量音乐链接。
145+ .. [3 ] 如果你省略了高质量音乐链接的地址, WeRoBot 会自动将音乐链接的地址用于高质量音乐链接。
146+
147+ TransferCustomerServiceReply
148+ -----------------------------
149+
150+ 将消息转发到多客服
Original file line number Diff line number Diff line change @@ -59,4 +59,8 @@ WeRoBot 0.4.0 中增加了功能强大的 Session 系统,你可以通过 Sessi
5959
6060.. module :: werobot.session.redisstorage
6161
62- .. autoclass :: RedisStorage
62+ .. autoclass :: RedisStorage
63+
64+ .. module :: werobot.session.saekvstorage
65+
66+ .. autoclass :: SaeKVDBStorage
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+
13import werobot
24
35robot = werobot .WeRoBot (token = 'tokenhere' )
68def hello_world (message ):
79 return 'Hello World!'
810
11+ @robot .filter ("帮助" )
12+ def show_help (message ):
13+ return """
14+ 帮助
15+ XXXXX
16+ """
17+
918robot .run ()
You can’t perform that action at this time.
0 commit comments