Skip to content

Commit 2e82ccc

Browse files
committed
Merge branch 'develop'
2 parents ec1e763 + 05dae25 commit 2e82ccc

File tree

21 files changed

+493
-26
lines changed

21 files changed

+493
-26
lines changed

README.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
WeRoBot
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

1413
WeRoBot 是一个微信机器人框架,采用MIT协议发布。
1514

docs/_templates/sidebarintro.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<h3>关于</h3>
22
WeRoBot 是一个高中生利用闲暇时间写成的微信公共平台开发框架。如果你喜欢 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

docs/changelog.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Changelog
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+
413
Version 0.5.3
514
----------------
615

docs/deploy.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,5 @@ server 支持以下几种:
8787
-----------------
8888

8989
参考: `示例仓库 <https://github.com/whtsky/WeRoBot-SAE-demo>`_
90+
91+
如果你需要使用 Session ,最好使用 :class:`werobot.session.saekvstorage` 。

docs/handlers.rst

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff 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"

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ WeRoBot 是一个微信机器人框架,采用 MIT 协议发布。
1515
replies
1616
session
1717
client
18+
pay
1819
deploy
1920
utils
2021
changelog

docs/pay.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
``WeRoBot.pay.WeixinPayClient`` —— 微信支付 API 操作类
2+
=================================
3+
4+
.. module:: werobot.pay
5+
6+
.. autoclass:: WeixinPayClient
7+
:members:

docs/replies.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
回复
22
==============
33

4-
目前WeRoBot共有三种Reply: `TextReply` , `ArticlesReply` `MusicReply` 。他们都继承自 `WeChatReply` 。
4+
目前WeRoBot共有四种Reply: `TextReply` , `ArticlesReply` `MusicReply` 和 `TransferCustomerServiceReply` 。他们都继承自 `WeChatReply` 。
55

66
TextReply
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+
将消息转发到多客服

docs/session.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff 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

example/hello_world.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
13
import werobot
24

35
robot = werobot.WeRoBot(token='tokenhere')
@@ -6,4 +8,11 @@
68
def hello_world(message):
79
return 'Hello World!'
810

11+
@robot.filter("帮助")
12+
def show_help(message):
13+
return """
14+
帮助
15+
XXXXX
16+
"""
17+
918
robot.run()

0 commit comments

Comments
 (0)