WeRoBot: writing WeChat Offical Account Robots with fun
Project description
WeRoBot 是一个微信公众号开发框架,采用MIT协议发布。
文档在这里: https://werobot.readthedocs.org/zh_CN/v1.1.1/
安装
推荐使用 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.1.1.tar.gz
(41.6 kB
view details)
Built Distributions
WeRoBot-1.1.1-py3-none-any.whl
(37.1 kB
view details)
WeRoBot-1.1.1-py2-none-any.whl
(37.1 kB
view details)
File details
Details for the file WeRoBot-1.1.1.tar.gz
.
File metadata
- Download URL: WeRoBot-1.1.1.tar.gz
- Upload date:
- Size: 41.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfabdf8043a0f3bf690bf2d2571f1f48346ff87486850ed00668d4979994ac20 |
|
MD5 | 219987f19f4eaaf40b59a87950de0d02 |
|
BLAKE2b-256 | f1bcfc4ad2f2004d464a2b47cd386f54c5f83c13cbb435334ddf2b05cd86716a |
File details
Details for the file WeRoBot-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: WeRoBot-1.1.1-py3-none-any.whl
- Upload date:
- Size: 37.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51ddf4434f7365db4d662c03fe38a2490f64e10287084dd6c97444f5c2ca37fc |
|
MD5 | 609c4954b354ef08852a792e1654b21e |
|
BLAKE2b-256 | 173c3d90dbb993319e2bce403f709a74f938adf01f55043a1580f93d0258b91e |
File details
Details for the file WeRoBot-1.1.1-py2-none-any.whl
.
File metadata
- Download URL: WeRoBot-1.1.1-py2-none-any.whl
- Upload date:
- Size: 37.1 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f2a63ad31f6c5ab7ce3971089a452503673a02fb67efc7064910a8fdaab0111 |
|
MD5 | 708719dd46457cf84f992c81b2784d88 |
|
BLAKE2b-256 | 27e668dc4dae14709cd34377e978e6b881159dc48ffee601d5b3d2a935340c40 |