Skip to content

Commit

Permalink
提交
Browse files Browse the repository at this point in the history
  • Loading branch information
YangRucheng committed Jan 12, 2025
0 parents commit 3b5cfac
Show file tree
Hide file tree
Showing 15 changed files with 1,737 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 发布 Pyhton 包到 PyPIs

on: push

jobs:
build-and-publish:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
node_modules
data
docs
tmp

.vscode
.DS_Store

*.log
*.sh
docker.sh
*.csv
*.jpg

ci.config.js
ci.py

project.private.config.json
package-lock.json

__pycache__/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 NoneBot

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
103 changes: 103 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<div align="center">

# NoneBot-Adapter-WXMP

_✨ 微信公众平台客服 协议适配 ✨_

</div>

<p align="center">
<a href="https://raw.githubusercontent.com/YangRucheng/nonebot-adapter-wxmp/master/LICENSE">
<img src="https://img.shields.io/github/license/YangRucheng/nonebot-adapter-wxmp" alt="license">
</a>
<a href="https://pypi.python.org/pypi/nonebot-adapter-wxmp">
<img src="https://img.shields.io/pypi/v/nonebot-adapter-wxmp" alt="pypi">
</a>
<img src="https://img.shields.io/badge/python-3.10+-blue" alt="python">
</p>

### 安装

```bash
pip install nonebot-adapter-wxmp
```
```bash
pip install git+https://github.com/YangRucheng/nonebot-adapter-wxmp.git#egg=nonebot-adapter-wxmp
```

### 加载适配器

```python
import nonebot
from nonebot.adapters.wxmp import Adapter as WxmpAdapter

nonebot.init()

driver = nonebot.get_driver()
driver.register_adapter(WxmpAdapter)
```

### 配置

#### 配置 .env 文件

##### 配置 Driver

```dotenv
DRIVER=~fastapi+~httpx
```

##### 配置 Bot

```dotenv
WXMP_BOTS='
[
{
"appid": "", # 小程序 AppID 或 公众号开发者 ID,以 wx 开头
"secret": "", # 小程序或公众号的密钥
}
]
'
```

#### 配置消息推送

+ URL(服务器地址): `https://example.com/wxmp/revice/<app_id>``https://example.com/wxmp/revice/<app_id>/`
+ 消息加密方式:明文模式
+ 数据格式:推荐 JSON (公众号为XML)

### 适配情况

<div align="center">

| | 小程序(事件推送) | 小程序(发送消息) | 公众号(事件推送) | 公众号(发送消息) |
| ------------ | ------------------ | ------------------ | ------------------ | ------------------ |
| 文字消息 |||||
| 图片消息 |||||
| 图文链接 |||||
| 小程序卡片 |||| |
| 语音消息 ||| | |
| 音乐消息 |||| |
| 视频消息 ||| | |
| 小视频消息 ||| | |
| 地理位置消息 ||| | |

</div>

❌官方不支持 · ✅已适配 · ❔未经测试

> 由于我没有已认证的 公众号/服务号,部分功能无法测试,已测试的事件在 `test/event.json` 中,如有问题请提 Issue!
### 参考文档

#### 微信开发文档

+ [公众号事件推送](https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html)
+ [公众号发送消息](https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html#客服接口-发消息)
+ [小程序事件推送]()
+ [小程序发送消息](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/kf-mgnt/kf-message/sendCustomMessage.html)

#### 其他补充信息

+ [不支持表情包](https://developers.weixin.qq.com/community/develop/doc/00000ee4eb8190937f227559f66c00)
4 changes: 4 additions & 0 deletions nonebot/adapters/wxmp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .bot import Bot
from .event import *
from .adapter import Adapter
from .message import Message, MessageSegment
Loading

0 comments on commit 3b5cfac

Please sign in to comment.