WeRoBot: writing WeChat Offical Account Robots with fun
Project description
WeRoBot 是一个微信公众号开发框架,采用MIT协议发布。
文档在这里: https://werobot.readthedocs.org/zh_CN/v1.2.0/
安装
推荐使用 pip 进行安装
pip install werobot
如果你没有安装 pip 而且正在使用一台 OS X / Linux 电脑,那么你应该运行
curl http://peak.telecommunity.com/dist/ez_setup.py | python curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
如果你是 Windows 用户, 那么下载 http://peak.telecommunity.com/dist/ez_setup.py 和 https://raw.github.com/pypa/pip/master/contrib/get-pip.py 这两个文件,双击运行。
Hello World
一个非常简单的 Hello World 微信公众号,会对收到的所有文本消息回复 Hello World
import werobot robot = werobot.WeRoBot(token='tokenhere') @robot.text def hello_world(): return 'Hello World!' robot.run()
Session
WeRoBot 在 0.4.0 版本中开始支持 Session , Session 可以用来方便的记录用户数据
import werobot robot = werobot.WeRoBot(token='tokenhere') @robot.text def session(message, session): last = session.get("last", None) if last: return last session["last"] = message.content return '这是你第一次和我说话' robot.run()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
WeRoBot-1.2.0.tar.gz
(52.6 kB
view details)
Built Distribution
WeRoBot-1.2.0-py3-none-any.whl
(40.7 kB
view details)
File details
Details for the file WeRoBot-1.2.0.tar.gz
.
File metadata
- Download URL: WeRoBot-1.2.0.tar.gz
- Upload date:
- Size: 52.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22e7a72fb370806c4246ec43c7393aef19b3027d544879ae02807702eee04a82 |
|
MD5 | 503dec70c22f7f617e8863b050591bcc |
|
BLAKE2b-256 | 639dbdf84672b21a8c5e8ddcda05b00b891721aa8a38f2282e35a7fa6669ab00 |
File details
Details for the file WeRoBot-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: WeRoBot-1.2.0-py3-none-any.whl
- Upload date:
- Size: 40.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1311bb762a1d28d5ccc6b4a90f0e712113337900486c5d82ec891c4b6d9aa37 |
|
MD5 | ef70bf7fef6b9a91b2ff08a56a9c0d0d |
|
BLAKE2b-256 | 25e7a2a29709b49e6e482737cfd86ca9fc34da36d155509f07881c2e0e7729c2 |