MsgBot
Python 实现的一个消息通知助手。可以使用钉钉群聊天机器人或者微信。
- 开发环境:
python 3.9 - 环境需求:
python 3
安装
pip install MsgBot
DingTalkBot
群机器人是钉钉群的高级扩展功能。群机器人可以将第三方服务的信息聚合到群聊中,实现自动化的信息同步。
DingTalkBot 前置条件
起码拥有一个钉钉群聊天机器人(获取自定义机器人webhookWebhook)(如何申请)
DingTalkBot demo
from MsgBot import DingTalkBot
# TestBot
dt_bot = DingTalkBot(
web_hook='your web_hook',
secret='your secret')
content_text = '今天天气真好,是么?'
dt_bot.send_text(content_text)
DingTalkBot 消息类型及 demo
-
text 类型
-
link 类型
-
markdown 类型
ps: 目前只支持md语法的子集,具体支持的元素如下(钉钉限定)
标题 # 一级标题 ## 二级标题 ### 三级标题 #### 四级标题 ##### 五级标题 ###### 六级标题 引用 > A man who stands for nothing will fall for anything. 文字加粗、斜体 **bold** *italic* 链接 [this is a link](http://name.com) 图片  无序列表 - item1 - item2 有序列表 1. item1 2. item2
-
整体跳转 ActionCard 类型
-
独立跳转 ActionCard 类型
-
FeedCard 类型
WxComBot
利用企业微信应用给微信用户或者企业微信用户发送消息。
使用微信接收企业微信消息助手消息,免安装企业微信客户端:
登陆企业微信后台微信插件,然后使用要接收消息的微信扫描二维码关注
关注过后即可接收到消息助手消息
如若要推广给他人,在微信进入该企业,点击【右上角➕号】-【设置】-【右上角...】-【推荐给朋友即可】
WxComBot 前置条件
- 拥有/创建一个用于消息通知的应用
可以/建议自己注册一个企业,非常简单,不需要进行认证即可使用
或者管理员给你创建好应用然后给你 secret 、应用id 、用户id等相关信息(= = 太麻烦了不建议) - 关键参数的获取:
WxComBot 避免重复通知
若微信通过上述微信插件关注了企业,而手机上又安装了企业微信
那么,同一条消息是会在微信和企业微信通知的
在微信不取关或者卸载企业微信的情况下,要避免也很简单
微信或者企业微信进入消息通知应用设置消息免打扰即可
某一方配置的免打扰不会影响另一方的正常通知
WxComBot demo
from MsgBot import WxComBot
wx_com_bot = WxComBot('corp_id', 'corp_secret')
msg = '你的快递已到,请携带工卡前往邮件中心领取。\n出发前可查看<a href="http://work.weixin.qq.com">邮件中心视频实况</a>,聪明避开排队。'
wx_com_bot.send_msg_text(agent_id='agent_id', content=msg, to_user='to_user')
WxComBot 消息类型及 demo
-
text 文本类型(可使用超链、换行)
-
Markdown 类型(该类型仅能在企业微信客户端查看)
应用支持推送文本、图片、视频、文件、图文、小程序、模板卡片等类型
目前仅实现了文本、Markdown类型,其余类型可根据实际需要和文档进行实现
参考链接
Metadata
Release files for msgbot 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| msgbot-0.1.3.tar.gz | 9.0 kB | Without provenance | Details for msgbot-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| msgbot-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for msgbot-0.1.3-py3-none-any.whl |
Total release size: 19.6 kB
Release files / msgbot-0.1.3.tar.gz
| Download URL | msgbot-0.1.3.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b959baef6e9ec64883e4b9330079d189cc1af2ce8ff8c5ce371a87b3889326f
|
|
BLAKE2b-256 checksum How to use checksums |
c8b59b0eb5445a129df74b6d2ed9d5c2c901896cd447c0e78eaaa670f7fb8a62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.7 Windows/11
|
Release files / msgbot-0.1.3-py3-none-any.whl
| Download URL | msgbot-0.1.3-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7e9f1766592397e9db4fd9da4670a9adae13301e5b0f9db930eafa0d4f55c97
|
|
BLAKE2b-256 checksum How to use checksums |
2084066c677f81110b47ad32c12f631f0951e4e328c4c79be66aa3a45d80b4dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.7 Windows/11
|
Security for msgbot 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.