-
Notifications
You must be signed in to change notification settings - Fork 1k
一些有点专断的改动 #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
一些有点专断的改动 #11
Conversation
… client for server test
@coveralls Yes I actually only change the way tests were written, but I will try to add more tests to improve the coverage score later, thanks for reminding. BTW, you are not a robot, are you? |
@reorx @coveralls 是 coveralls 的机器人… |
有不少想合并的地方:
但是有些不想接受的,比如一种类型的消息只能有一个 handler … |
或者我再发一个对非 master 分支的 pull request,是用 develop 还是你再开一个新分支?我这里只能选择你的库里存在的分支。 |
可以开个新的 issue 专门讨论下 handler 和消息类型的绑定机制问题。现在一个你的一个我的两个方案,算是各有优缺点吧,我会在 issue 里详细阐述下我的想法。 |
@reorx develop 分支吧; |
需要花点时间理清楚,今天没时间。 |
出于自用的目的,就把框架改动了一下,大概在以下几个方面:
改变之前的
import werobot.utils
然后调用werobot.utils.xxx
的做法,明确地引用所使用的函数from werobot.utils import xxx
WeRoBot.handler
装饰器,指定消息类型的处理函数应该明确声明 (Explicit is better than implicit)_fallback
伪消息类型用于处理无对应处理函数的消息_get_reply
中使用异常处理机制,将产生异常的消息移交 fallback handler 处理create_reply
的 replay 可以是None
,代表无回复。除此外必须是可以生成合法的消息的数据。WeRoBot.settings
属性,用于存储和更改配置,并在相应的地方(如run
)引用logging
的配置处理,以后可以在项目中使用logging
记录日志了有点专断,所以本来不大好意思提交了……想了下还是发了,毕竟作为这个项目的受益者,回馈是必须的呀~