NoneBot adapter for WeChat
Project description
简介
本项目为 NoneBot2 提供了一个 Gewechat 适配器。
安装
pip
pip install nonebot-adapter-gewechat
# 如果需要将登录二维码保存为图片,请使用以下命令安装
pip install nonebot-adapter-gewechat[png]
nb cli
nb adapter install nonebot-adapter-gewechat
# 如果需要将登录二维码保存为图片,请使用以下命令安装
nb adapter install nonebot-adapter-gewechat[png]
配置
Driver 配置
需要 HTTP 客户端驱动器 和 ASGI 服务端驱动器
推荐 fastapi+httpx
DRIVER="~fastapi+~httpx"
Gewechat 配置
GEWECHAT_API_URL="http://127.0.0.1:2531/v2/api"
GEWECHAT_DOWNLOAD_API_URL="http://127.0.0.1:2532/download"
GEWECHAT_CALLBACK_URL="http://127.0.0.1:8080/gewechat/callback/collect"
GEWECHAT_CALLBACK_PATH="/callback/collect"
SELF_MSG=false
配置对应 Gewechat 的配置
GEWECHAT_API_URLGewechat API 地址GEWECHAT_DOWNLOAD_API_URLGewechat 下载 API 地址GEWECHAT_CALLBACK_URL接收回调地址GEWECHAT_CALLBACK_PATHGewechat 回调路径SELF_MSG是否接收自己发送的消息
账号配置
WXID="wxid_xxxxx"
APPID="wx_xxxxxxx"
其中,APPID 留空即为更换设备登录,首次登录请留空
API接口
具体接口可前往GeweChat文档查看, Bot类中已封装接口
[!WARNING] Gewechat目前只支持图片的下载,语音、视频等暂不支持
示例
from nonebot import on_message
from nonebot.adapters.gewechat.message import MessageSegment, Message
from nonebot.adapters.gewechat.event import ImageMessageEvent, EmojiMessageEvent
from nonebot.adapters.gewechat.bot import Bot
revoke = on_message(priority=5)
@revoke.handle()
async def _(bot: Bot, event: ImageMessageEvent):
await bot.revokeMsg(
event.FromUserName,
event.MsgId,
event.newMsgId,
event.CreateTime
)
emoji = on_message(priority=10)
@emoji.handle()
async def _(bot: Bot, event: EmojiMessageEvent):
await emoji.send(MessageSegment.emoji(
event.md5,
event.md5_size
))
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonebot_adapter_gewechat-0.5.2.tar.gz.
File metadata
- Download URL: nonebot_adapter_gewechat-0.5.2.tar.gz
- Upload date:
- Size: 32.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad431fd2337645c990d124a6c73ac2e15b61e993d69fa5c8ce81397fc431b42b
|
|
| MD5 |
4ff93d6825f7bf93c84a73b363fe9e08
|
|
| BLAKE2b-256 |
b3e06c2ed4f2e15fcbb72b5d53ed9b639097e00d12b1fa34ccd85f6d28acfe3f
|
Provenance
The following attestation bundles were made for nonebot_adapter_gewechat-0.5.2.tar.gz:
Publisher:
pypi-publish.yml on Shine-Light/nonebot-adapter-gewechat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_adapter_gewechat-0.5.2.tar.gz -
Subject digest:
ad431fd2337645c990d124a6c73ac2e15b61e993d69fa5c8ce81397fc431b42b - Sigstore transparency entry: 191386343
- Sigstore integration time:
-
Permalink:
Shine-Light/nonebot-adapter-gewechat@a01155c7e460b878a7c92ee96f053d73a803c935 -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/Shine-Light
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@a01155c7e460b878a7c92ee96f053d73a803c935 -
Trigger Event:
release
-
Statement type:
File details
Details for the file nonebot_adapter_gewechat-0.5.2-py3-none-any.whl.
File metadata
- Download URL: nonebot_adapter_gewechat-0.5.2-py3-none-any.whl
- Upload date:
- Size: 36.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dab5cc594f936803ef59a57cb737df5abd34f4ebf7fbe6fb7c19cbd3654c0148
|
|
| MD5 |
5b3aca90e1fc5fc5eb218e5746b54c2c
|
|
| BLAKE2b-256 |
2718cd613ee3a711a47eeda87c4bbc77250e0f8575a13790232618c140847868
|
Provenance
The following attestation bundles were made for nonebot_adapter_gewechat-0.5.2-py3-none-any.whl:
Publisher:
pypi-publish.yml on Shine-Light/nonebot-adapter-gewechat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nonebot_adapter_gewechat-0.5.2-py3-none-any.whl -
Subject digest:
dab5cc594f936803ef59a57cb737df5abd34f4ebf7fbe6fb7c19cbd3654c0148 - Sigstore transparency entry: 191386346
- Sigstore integration time:
-
Permalink:
Shine-Light/nonebot-adapter-gewechat@a01155c7e460b878a7c92ee96f053d73a803c935 -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/Shine-Light
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@a01155c7e460b878a7c92ee96f053d73a803c935 -
Trigger Event:
release
-
Statement type: