功能特性
- 天气查询:输入城市名称获取实时天气信息
- 每日推送:订阅每日定时天气预报,支持群聊和私聊
- 跨平台兼容:基于 nonebot-plugin-alconna,支持多种聊天适配器
依赖
- nonebot-plugin-htmlrender - HTML 渲染
- nonebot-plugin-alconna - 跨适配器命令处理
- nonebot-plugin-apscheduler - 定时任务
- nonebot-plugin-localstore - 数据持久化
需要先保证 playwright 可以正常运行并在系统(或容器中)存在中文字体
安装
直接使用 pip install nonebot-plugin-heweather 进行安装
在 bot.py 中 写入 nonebot.load_plugin("nonebot_plugin_heweather")
指令
天气查询
天气+地区 或 地区+天气
例如:上海天气 或 天气广州
每日推送
| 指令 | 说明 | 示例 |
|---|---|---|
天气订阅 城市 HH:MM |
订阅每日天气推送 | 天气订阅 上海 08:30 |
天气取消订阅 |
取消当前订阅 | 天气取消订阅 |
天气订阅状态 |
查看当前订阅配置 | 天气订阅状态 |
说明:
- 推送时间使用 24 小时制,格式为
HH:MM - 每个群聊/用户可订阅多个城市
- 群聊中需要管理员权限才能管理订阅
- 订阅数据保存在 NoneBot 数据目录中
配置
JWT 认证配置
参考文档 身份认证 生成 Ed25519 密钥,并且上传公钥
# JWT sub,即控制台中的项目管理的项目ID
QWEATHER_JWT_SUB=
# JWT Key ID,在控制台上传公钥后获取,凭据 ID
QWEATHER_JWT_KID=
# JWT 私钥文本,需要自行生成,需要单行填写,例如
# qweather_jwt_private_key="-----BEGIN PRIVATE KEY-----\n123abc\n-----END PRIVATE KEY-----"
QWEATHER_JWT_PRIVATE_KEY=
API 主机配置
参考文档 API 配置 在 控制台-设置 获取地址。务必添加 scheme https://
# API 主机地址,默认为 https://api.qweather.com
QWEATHER_APIHOST=https://api.qweather.com
天气预报配置
# 每日预报天数,默认 3 天 根据订阅类型可选最多 30 天
QWEATHER_FORECASE_DAYS=3
# 逐小时预报类型
# 1 = 未来12小时 (默认值)
# 2 = 未来24小时
QWEATHER_HOURLYTYPE=1
调试配置
# 是否开启调试模式,默认为 false
DEBUG=false
配置获取方式
- 进入控制台
- 项目管理 -> 创建项目
- 创建凭据
- 选择 JWT 类型,并按照文档创建公钥和私钥
- 上传公钥并保存提交
- 设置 -> 开发者信息 -> API Host 获取地址
- 填写 .env 文件
参考文档
Metadata
Release files for nonebot-plugin-heweather 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nonebot_plugin_heweather-0.11.0.tar.gz | 1.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nonebot_plugin_heweather-0.11.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.3 MB
Release files / nonebot_plugin_heweather-0.11.0.tar.gz
| Download URL | nonebot_plugin_heweather-0.11.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8ad6c77bbbc63c824491ddebd355f6ac0f511d0c35bcef4f11e56ba49b30f54
|
|
BLAKE2b-256 checksum How to use checksums |
bce0b2122aa57e6d5a70481f146ce73caf778871af5c2998ea4288639f866e05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 3, 2026.
Transparency logRelease files / nonebot_plugin_heweather-0.11.0-py3-none-any.whl
| Download URL | nonebot_plugin_heweather-0.11.0-py3-none-any.whl |
|---|---|
| Size | 99.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a444a2d743998fb4384ab8388798f4976a7df5c4de6cee008e1322495e1fcfb5
|
|
BLAKE2b-256 checksum How to use checksums |
e119842507d2654004399e2473f6b9cc290ec6aaf8f9a078fe54a66217fdf18e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 3, 2026.
Transparency log