Skip to main content

nonebot

nonebot-adapter-claweixin

✨ weixin clawbot 协议适配 ✨

CodeFactor NoneBot

配置

修改 NoneBot 配置文件 .env 或者 .env.*

Driver

参考 driver 配置项,添加 HTTPClient 支持

如:

DRIVER=~httpx

配置机器人

可选依赖 nonebot-adapter-claweixin[qrcode] 用于终端中显示二维码 可选依赖 nonebot-adapter-claweixin[login] 用于完整登录流程

环境变量介绍:

环境变量 默认值 作用
CLAWEIXIN_TOKEN [] 微信 bot token 列表。配置后适配器会为每个 token 创建一个 bot 并开始轮询消息。
CLAWEIXIN_LOGIN_QRCODE_IN_INFO false 启动机器人时执行扫码登录流程,并通过日志输出二维码或二维码链接。
CLAWEIXIN_API_ROOT https://ilinkai.weixin.qq.com 微信 iLink API 根地址。只有官方接口地址变化、测试环境、代理网关等场景才需要修改。
CLAWEIXIN_CDN_ROOT https://novac2c.cdn.weixin.qq.com/c2c 微信 CDN 上传/下载根地址,用于图片、文件、视频等媒体上传下载。
CLAWEIXIN_BOT_AGENT nonebot-adapter-claweixin 上报给官方接口的 bot 身份标识,类似 User-Agent,主要用于服务端观测和排查。
CLAWEIXIN_ROUTE_TAG 空字符串 可选路由标签,会作为 SKRouteTag 请求头发送,主要用于测试、灰度或特殊路由。

第一步:登陆

方法一:

配置环境变量:

CLAWEIXIN_LOGIN_QRCODE_IN_INFO=true

这个环境变量会在机器人启动时获取登陆二维码,然后扫描对应二维码(可以通过访问链接/或者安装qrcode 终端扫描)

即可完成登陆和机器人注册,如果需要持久化,可参考第二步

方法二: 有 nb-cli 环境可以使用

nb claweixin-login

无 nb-cli 环境可以直接使用

claweixin-login

此方法会执行完整 CLI 登录流程,支持扫码、已绑定识别、重定向轮询和手机配对码验证 登录成功后会输出 CLAWEIXIN_TOKEN,如需持久化请执行第二步

第二步:可选的持久化 Token

单个机器人

CLAWEIXIN_TOKEN=["xxx"]

多个机器人

CLAWEIXIN_TOKEN=["aaa","bbb"]

相关项目

Metadata

Release files for nonebot-adapter-claweixin 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-adapter-claweixin 0.1.11
File Size Uploaded
nonebot_adapter_claweixin-0.1.11.tar.gz 26.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-adapter-claweixin 0.1.11
File Interpreter ABI Platform
nonebot_adapter_claweixin-0.1.11-py3-none-any.whl Python 3 none any Details

Total release size: 59.6 kB

Release files / nonebot_adapter_claweixin-0.1.11.tar.gz

Download URL nonebot_adapter_claweixin-0.1.11.tar.gz
Size 26.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a3801bedd0c27430a2104cb0ffc64b105b4afb509ea236ade4ea4d62bef8d4c0
BLAKE2b-256 checksum
How to use checksums
fd2e9fb0db20e6201546c41d5c085d0d72b2b6d73c97771fc26ada874d9b0bbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.26.7 CPython/3.12.10 Windows/11

Release files / nonebot_adapter_claweixin-0.1.11-py3-none-any.whl

Download URL nonebot_adapter_claweixin-0.1.11-py3-none-any.whl
Size 33.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7dafc998bf4dd853d1d0bfab5ea0114a9bc1d6108be287542c38d2e48e349807
BLAKE2b-256 checksum
How to use checksums
9be9375a50b0373219e2e7e996b4f3c2c533f984dc1945888c323bf05b77be54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.26.7 CPython/3.12.10 Windows/11

Release history Release notifications | RSS feed

This release

0.1.11 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page