Skip to main content

NoneBotPluginLogo

nonebot-plugin-nowtime

⭐基于Nonebot2的一款整点报时的插件⭐

⭐ 介绍

基于nonebot-plugin-apscheduler 让bot为你整点报时吧

💿 安装

nb-cli安装

在项目目录文件下运行

nb plugin install nonebot_plugin_nowtime
pip安装
pip install nonebot-plugin-nowtime

🛠️ 开发

使用 uv 管理依赖和构建项目:

uv sync --locked
uv run pre-commit install
uv run pre-commit run --all-files

提交前会自动检查文件格式,并使用 Ruff 检查和格式化 Python 代码。 也可以手动检查或构建发布包:

uv run ruff check .
uv run ruff format --check .
uv run python -m unittest discover -s tests -v
uv build

🚀 自动测试与发布

推送到 main 或向 main 提交 PR 时,GitHub Actions 会在 Python 3.10–3.13 上 安装锁定依赖,执行 Ruff 检查、单元测试并构建发布包。

发布沿用 game-torrent 的 PyPI Token 方式:

  1. 在 GitHub 仓库的 Settings → Secrets and variables → Actions 中添加 PYPI_API_TOKEN,值为该 PyPI 项目的 API Token。
  2. 更新 pyproject.toml 的版本号及 uv.lock,提交改动。
  3. 推送与版本号一致的 v 标签,例如版本 0.2.0 对应 v0.2.0。

标签触发后会先运行完整测试矩阵,全部通过且标签与版本一致时才上传到 PyPI。

⚙️ 配置

运行环境要求 Python 3.10 及以上。

在全局配置文件.env中添加如下

start_time = 8
end_time = 20

默认下配置为24小时全天播报,所以觉得很烦的请自行设置时间(采用24小时制)

群开关数据由 nonebot-plugin-localstore 管理,保存至插件数据目录的 nowtime.json。首次启动时,如果新文件不存在,会自动读取运行目录下旧的 config/nowtime.json 并迁移,原文件保留;后续以新文件为准。 可通过 nb localstore 查看存储目录,或通过 localstore 配置自定义数据路径。

插件不依赖固定适配器,消息通过 Alconna 发送,管理员与群主权限由 nonebot-plugin-uninfo 获取。可用平台为两者共同支持的适配器;平台未提供角色信息时, 由超级用户管理报时。语音支持取决于平台,不支持语音时仍会发送文字报时。

每条订阅记录适配器、机器人、群或频道 ID,并保留频道的父级 ID。 旧版群号列表按原平台保留,不会转发到其他平台;切换平台后请重新开启报时。

⭐ 使用

指令:

指令 需要@ 范围 说明 权限
北京时间 否 私聊、群聊 查看现在时间 任何
开启、关闭整点报时 [群号] 否 群聊、私聊 省略群号操作当前群;私聊必须指定群号 群主,超管,管理员(私聊仅超管)
查看整点报时列表 否 群聊 查看已开启整点报时的群聊 群主,超管,管理员

如:

/开启整点报时

注意

默认情况下, 您应该在指令前加上命令前缀, 通常是 /

命令由 nonebot-plugin-alconna 解析,遵循 NoneBot 的 COMMAND_START 配置。 指定群号时可使用 /开启整点报时 123456,也兼容 /开启整点报时123456。 群或频道 ID 支持字符串,省略 ID 时操作当前群或频道;列表只显示当前机器人的订阅。 群主和管理员只能管理当前群或频道,跨群操作仅限超级用户。

🌙 未来todo

  • 添加语音整点报时
  • 自定义播报时间
  • 优化整点报时词库
  • 图片整点报时

❤️ 鸣谢

Metadata

Release files for nonebot-plugin-nowtime 0.3.0

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-plugin-nowtime 0.3.0
File Size Uploaded
nonebot_plugin_nowtime-0.3.0.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-nowtime 0.3.0
File Interpreter ABI Platform
nonebot_plugin_nowtime-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.4 kB

Release files / nonebot_plugin_nowtime-0.3.0.tar.gz

Download URL nonebot_plugin_nowtime-0.3.0.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9c509992f2dbb477a601334a40c8086fe3705abcf51d0ef7ee567488de744d64
BLAKE2b-256 checksum
How to use checksums
01b247203ab99a33f3bd93a57033591d93e8a8a6bf6bb2e16e9ccbd3c599f6fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / nonebot_plugin_nowtime-0.3.0-py3-none-any.whl

Download URL nonebot_plugin_nowtime-0.3.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38e1872565873538494be87288c1a36d328189580f8951a8ff1cff020f54c37d
BLAKE2b-256 checksum
How to use checksums
97213c48950da3d2e722fb5c3ba4ad1371c87c0ae4c2ae46f173e796f14023e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

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