Skip to main content

按群订阅 Git 仓库更新的 NoneBot2 插件,支持多仓库、多分支定时拉取

Project description

logo

✨ nonebot-plugin-git-poller ✨

LICENSE pypi python uv codecov

按群订阅 Git 仓库更新的 NoneBot2 插件,支持多仓库、多分支定时拉取,自动推送 commit 更新摘要并上传源码压缩包。

支持 GitHub、GitLab、Gitee 以及自建 Git 服务等主流 Git 托管平台,兼容标准 HTTP/HTTPS Git 远端。

💿 安装

使用 nb-cli 安装
nb plugin install nonebot-plugin-git-poller
使用包管理器安装

在 NoneBot 项目目录中,根据你使用的包管理器,输入相应的安装命令:

uv
uv add nonebot-plugin-git-poller
pdm
pdm add nonebot-plugin-git-poller
poetry
poetry add nonebot-plugin-git-poller

打开 NoneBot 项目根目录下的 pyproject.toml 文件,在 [tool.nonebot] 部分追加写入:

[tool.nonebot]
plugins = ["nonebot_plugin_git_poller"]

⚙️ 配置

配置项 必填 默认值 说明
git_poller_default_schedule 每天04:00 新关注仓库的默认定时规则;留空关闭默认定时注册。
git_poller_timezone +8 定时任务 UTC 偏移量,含半点时区,例如 +8.5-3.5
git_poller_proxy HTTP/HTTPS Git 拉取代理。
git_poller_timeout 60.0 HTTP/HTTPS Git 拉取超时,单位秒。
git_poller_upload_api_timeout 3600.0 调用 OneBot 上传压缩包 API 的超时,单位秒。
git_poller_archive_password 全局压缩包密码;为空时不自动加密。
git_poller_file_base_url 条件 上传文件使用的 NoneBot HTTP 服务根地址;Bot 和 协议端 不在同一个文件系统时必须配置,例如 http://nonebot:8088 。NapCat 协议端在 v4.8.115 起支持直接传输,无需配置此项。

🎉 指令

/关注仓库 仓库url [--分支名]
/取关仓库 仓库url [--分支名]
/设置仓库 仓库url [--分支名]
/拉取仓库 仓库url [--分支名]
/仓库摘要 仓库url [--分支名]
/仓库列表

带 URL 的命令都支持可选分支后缀,例如 /关注仓库 https://example.test/repo.git --dev/关注仓库 不写分支时追踪远端默认分支;其他命令不写分支时优先使用本群本仓库的唯一订阅,若同仓库关注了多个分支则需要写 --分支名

/关注仓库 在当前群关注仓库。同一个群可以关注同一仓库的不同分支。

/取关仓库 移除当前群的对应仓库分支订阅,不影响其他群。

/设置仓库 进入设置流程。Bot 会回复:

输入设置数字选项
1. 修改当前仓库推送抓取时间
2. 修改当前仓库上传压缩包密码(选择后输入无则清除当前仓库密码)

回复 1 后,下一条消息必须是合法定时格式。回复 2 后,下一条消息会保存为当前仓库压缩包密码,此时输入 会清除当前仓库密码。输入非法会取消。

定时格式

每天hh:mm
每隔hh:mm
每x天hh:mm
周xhh:mm

每隔 的时间范围是 00:0123:59每x天x 使用 1 到 30 的整数;周x 只支持汉字 一二三四五六日/天

/仓库列表 显示当前群关注的仓库 Git 链接、分支、计划时间、SHA 和实际使用的压缩包密码。

/拉取仓库 立即拉取当前群已关注的仓库,上传最新的源码压缩包。

/仓库摘要 仅拉取远端并展示本群记录与远端 HEAD 的差异。

⚠️ 注意事项

使用 NapCat 上传较大的仓库压缩包时,如果 Bot 宿主机实际上传速度较慢,可能会出现“文件最终发送成功,但 NapCat API 先返回超时错误”的情况。这是 NapCat 在等待 QQNT 的发送回执时超时导致的伪超时,会导致本插件无法正常使用。

NapCat 在 v4.17.49 起提供了上传/下载超时预测配置。若遇到此类情况,请在 NapCat WebUI 的 OneBot 配置中自行调整: 预估上传速度(KB/s)最大超时时间(毫秒)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_plugin_git_poller-0.2.0.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nonebot_plugin_git_poller-0.2.0-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_git_poller-0.2.0.tar.gz.

File metadata

  • Download URL: nonebot_plugin_git_poller-0.2.0.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for nonebot_plugin_git_poller-0.2.0.tar.gz
Algorithm Hash digest
SHA256 654bfc870742a5c1448b9aabf0b454b7c8e0e06e0dcfe4fa91ce7088547dfde5
MD5 ee2abbc73145b557cbaa05bd74d64653
BLAKE2b-256 4a29ee749f36427c329c46881e2acd735a8ca95962d6407dea79f1a415158992

See more details on using hashes here.

File details

Details for the file nonebot_plugin_git_poller-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: nonebot_plugin_git_poller-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for nonebot_plugin_git_poller-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa6a714fc479ecc04391277966e141ba6eb31e4ded4b69986995f558a5802883
MD5 d04f47694e6021372205f1a0014b2112
BLAKE2b-256 1c07b3c79f1d42361d57a3539a534b219339a24f5253237d11c38aaf4f128894

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page