mirror of
https://github.com/Gloridust/WechatOnCloud.git
synced 2026-06-16 19:53:53 +08:00
feat(ci/telegram): 发布通知自动置顶 + 取消上一个 release 的置顶
tg-notify.mjs:release/手动触发发完消息后,用 getChat 读群当前置顶(=上一个 release), pinChatMessage 置顶新消息(静音,避免二次提醒)、unpinChatMessage 取消旧的——无需持久化存储。 issue 通知不置顶;置顶失败(机器人非管理员/无置顶权限)仅跳过、不影响通知本身。 文档补充:需把机器人设为群管理员并开启「置顶消息」权限。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Binary file not shown.
+4
-2
@@ -81,11 +81,11 @@ docker buildx build --platform linux/amd64,linux/arm64 \
|
|||||||
|
|
||||||
## Telegram 发布通知(可选,免服务器)
|
## Telegram 发布通知(可选,免服务器)
|
||||||
|
|
||||||
仓库内置 [.github/workflows/telegram-notify.yml](../.github/workflows/telegram-notify.yml):**新版本发布** / **新 issue** 时,通过 Telegram Bot 推送到群组。跑在 GitHub Actions 上,无需服务器;未配置则自动跳过。
|
仓库内置 [.github/workflows/telegram-notify.yml](../.github/workflows/telegram-notify.yml) + [.github/scripts/tg-notify.mjs](../.github/scripts/tg-notify.mjs):**新版本发布** / **新 issue** 时,把内容(GitHub Markdown 渲染为 Telegram HTML)推送到群组。跑在 GitHub Actions 上,无需服务器;未配置则自动跳过。**发布通知还会自动置顶,并取消上一个 release 的置顶**(群里始终只置顶最新版本)。
|
||||||
|
|
||||||
一次性配置:
|
一次性配置:
|
||||||
|
|
||||||
1. 把机器人(如 `@WechatOnCloudBot`)拉进目标 Telegram 群组;需要发言权限时设为管理员。
|
1. 把机器人(如 `@WechatOnCloudBot`)拉进目标 Telegram 群组。**要让"自动置顶"生效,需把机器人设为群管理员并开启「置顶消息」权限**(缺权限时通知照发、仅置顶被跳过,不影响主流程)。
|
||||||
2. 取群组 chat id:bot 进群后在群里发条消息,浏览器打开 `https://api.telegram.org/bot<BOT_TOKEN>/getUpdates`,找 `result[].message.chat.id`(群组通常是 `-100` 开头的负数)。
|
2. 取群组 chat id:bot 进群后在群里发条消息,浏览器打开 `https://api.telegram.org/bot<BOT_TOKEN>/getUpdates`,找 `result[].message.chat.id`(群组通常是 `-100` 开头的负数)。
|
||||||
3. 仓库 **Settings → Secrets and variables → Actions**:
|
3. 仓库 **Settings → Secrets and variables → Actions**:
|
||||||
- **Variables** 标签 → `TELEGRAM_CHAT_ID` = 上面的 chat id;
|
- **Variables** 标签 → `TELEGRAM_CHAT_ID` = 上面的 chat id;
|
||||||
@@ -93,6 +93,8 @@ docker buildx build --platform linux/amd64,linux/arm64 \
|
|||||||
|
|
||||||
之后每次「发布 Release / 新建 issue」都会自动推送。想关掉 issue 推送,删掉 workflow 里 `on:` 下的 `issues:` 即可。
|
之后每次「发布 Release / 新建 issue」都会自动推送。想关掉 issue 推送,删掉 workflow 里 `on:` 下的 `issues:` 即可。
|
||||||
|
|
||||||
|
> **自动置顶原理**:发完新消息后,用 `getChat` 读出群当前置顶消息(即上一个 release),置顶新消息、再取消旧的——无需任何持久化存储。issue 通知不置顶。手动 **Run workflow** 也会置顶(发的是最新 release),可用来测试。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Telegram 命令机器人(可选,免服务器,轮询版)
|
## Telegram 命令机器人(可选,免服务器,轮询版)
|
||||||
|
|||||||
Reference in New Issue
Block a user